목록PHP (9)
4번독수리의 둥지
// pseudo database table$contents = range(1, 255);rsort($contents);//print_r($contents); $now = $_GET['now'];if (!$now) { $now = 1;} // pseudo pagination object$p = array();$p['types'] = array('simple', 'centered');// set pagination config$p['size'] = 7;$p['psize'] = 5;$p['type'] = 'simple';// pagination preset info$p['now'] = $now;$p['total'] = count($contents);// generate pagination info$p['pt..
on PHP 5.1.6 1. define(FOO, 'bar'); echo FOO; -------- bar 2. function foo() { define(BAR, 'baz'); } foo(); echo BAR; -------- baz 3. $foo = 'bar'; define(BAZ, $foo); unset($foo); echo $foo; echo '--'; echo BAZ; -------- --bar 4. class Foo { public function __construct() { self::bar(); } public static function bar() { define(BAZ, 'quux'); } } $norf = new Foo(); echo BAZ; -------- quux 5. define(..
http://php.net/manual/en/functions.user-defined.php http://stackoverflow.com/a/14753616 The following codes use this feature for setting hex2bin() compartible in a class MyClass on PHP5. class MyClass { public function __construct() { self::compat(); } private static function compat() { if (!function_exists('hex2bin')) { function hex2bin($hexString) { return pack('H*', $hexString); } } } public ..
http://php.net/manual/kr/features.gc.refcounting-basics.php http://php.net/manual/kr/features.gc.collecting-cycles.php http://php.net/manual/kr/features.gc.performance-considerations.php Memory Leaks With Objects in PHP 5 http://paul-m-jones.com/archives/262 http://stackoverflow.com/questions/584960/whats-better-at-freeing-memory-with-php-unset-or-var-null
http://www.lornajane.net/posts/2011/downgrading-a-pecl-module pecl install -f oauth-1.0.0
$status = '';for ( $len = 2000; $status != '414'; $len+=10 ) { $status = execute($len);}echo $len, "\n";exit;function execute( $len ) { // 10*n length url $url = 'http://example.com?abcdefghijk=1'; $i = 0; do { // 10 length get parameter $url.= '&a'.str_pad("$i", 6, '0').'=1'; $i++; } while ( strlen($url)+10 $ch = curl_init($url); curl_setopt_array($ch, array( CURLOPT_RETURNTRANSFER => tr..
http://gotofritz.net/blog/howto/removing-empty-array-elements-php/
array_keys(array_flip($array)); http://stackoverflow.com/questions/5036504/php-performance-question-faster-to-leave-duplicates-in-array-that-will-be-searc#comment19991540_5036538
Note that $_POST is NOT set for all HTTP POST operations, but only for specific types of POST operations. I have not been able to find documentation, but here's what I've found so far. $_POST _is_ set for: Content-Type: application/x-www-form-urlencoded In other words, for standard web forms. $_POST is NOT set for: Content-Type:text/xml A type used for a generic HTTP POST operation. http://php.n..