1 | <?php |
---|
2 | |
---|
3 | function testIt($func) { |
---|
4 | $hex = ''; |
---|
5 | $chars = preg_split('//', $func, -1, PREG_SPLIT_NO_EMPTY); |
---|
6 | foreach ($chars as $c) { |
---|
7 | $hex .= sprintf("\x%02X", ord($c)); |
---|
8 | } |
---|
9 | echo "------------------------------------\n"; |
---|
10 | echo "Function: $func\n"; |
---|
11 | echo "Hex: $hex\n"; |
---|
12 | echo "Length: " . strlen($func) . "\n"; |
---|
13 | echo "Trimemed length: " . strlen(trim($func)) . "\n"; |
---|
14 | echo "------------------------------------\n"; |
---|
15 | echo "\n"; |
---|
16 | } |
---|
17 | |
---|
18 | echo "\n"; |
---|
19 | testIt(create_function('$somevar', 'return true;')); |
---|
20 | testIt('testIt'); |
---|
21 | echo "\n"; |
---|