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 | |
/** | |
* Run this script as-is and it will segfault. My setup is Ubuntu | |
* 11.10, library details: | |
* | |
* php5-cli : 5.3.6-13ubuntu3.6 (output from dpkg -l) | |
* libevent : 0.0.5 beta (output from pecl list) | |
* php-pear : 5.3.6-13ubuntu3.6 (output from dpkg -l) | |
* | |
* There are 2 things you can do to stop the segfault: |
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 | |
$php = "<html><head><?php include '/foo/bar/php'; ?></head>...."; | |
foreach (token_get_all($php) as $tok) { | |
if (is_array($tok)) { | |
printf("token type %s: %s\n", token_name($tok[0]), $tok[1]); | |
} | |
} |
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 = array(); | |
for ($i = 0; $i < 1000; $i++) { | |
$a[] = rand(0,1000000); | |
} | |
printf("Start, first mine:\n"); | |
$t1 = microtime(true); | |
var_dump(mine($a)); |