This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
echo gethostbyaddr( '124.83.147.212' ); // f6.top.vip.ogk.yahoo.co.jp | |
echo gethostbyaddr( '2001:470:0:64::2' ); // ipv6.he.net |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$app_id = 'あなたのapp ID'; | |
$app_secret = 'あなたのapp secret key'; | |
$my_url = 'あなたのapp url'; | |
$code = isset($_GET['code']) ? $_GET['code'] : ''; | |
if ( $code === '' ) { | |
$dialog_url = "http://www.facebook.com/dialog/oauth?client_id={$app_id}&scope=read_stream&redirect_uri=".urlencode($my_url); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$time = file_get_contents('http://ntp-a1.nict.go.jp/cgi-bin/time') or die; | |
$time = strtotime( $time ); | |
$cmd = 'date ' . date('mdHiY.s', $time); | |
`$cmd`; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$str = " | |
ファック!ファック!ファックマンデー!キル!キル!キルマンデー! | |
ファック!ファック!ファックマンデー!キル!キル!キルマンデー! | |
月曜ころす ブルーマンデー | |
キルマンデー チープサラリー | |
ファック!ファック!ファックマンデー!キル!キル!キルマンデー! | |
ファック!ファック!ファックマンデー!キル!キル!キルマンデー! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$arr = array( | |
'あああ', | |
'いいい', | |
'#ううう', | |
'#えええ', | |
'おおお', | |
); | |
foreach( $arr as $k => $v ) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function unko( $url ){ | |
$def = stream_context_get_default( | |
array( | |
'http' => array( | |
'method' => "HEAD", | |
'protocol_version' => "1.1", | |
'header' => "Accept-Encoding: gzip\r\n". | |
"Connection: close\r\n", | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$log = file( 'http://php.net/ChangeLog-5.php' ) or die( 'error' ); | |
$buf = array(); | |
foreach ( $log as $line ) { | |
$tmp = trim( $line ); | |
if ( preg_match( '/^<h3>Version\s+\d.+?<\/h3>/i', $tmp ) ) { | |
$buf[] = "\n--------" . trim( strip_tags( $line ) ); | |
} | |
if ( preg_match( '/^<li>(Upgraded|Updated|Added|Change|Removed|Allowed).+/i', $tmp ) === 1 ) { | |
$buf[] = trim( strip_tags( $line ) ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$json_str = '{"hoge":"ほげ", "fuga":"ふが"}'; | |
$json = json_decode( $json_str ); | |
echo $json->hoge; // ほげ | |
echo $json->fuga; // ふが |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function test_apache( $host ){ | |
$bytes = '0-10000,1-10001,2-10002,3-10003,4-10004,5-10005'; | |
$def = stream_context_get_default( | |
array( | |
'http'=>array( | |
'method' => "HEAD", | |
'protocol_version' => "1.1", | |
'header' => "Range:bytes={$bytes}\r\n". |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$a = [ 1, 2, 3 ]; | |
print_r( $a ); | |
$a = [ 'unko' => 'うんこ', 'geri' => 'ゲリ' ]; | |
print_r( $a ); | |
/* | |
Array | |
( | |
[0] => 1 |