Skip to content

Instantly share code, notes, and snippets.

@niklasvh
Created July 24, 2012 17:48
Show Gist options
  • Save niklasvh/3171462 to your computer and use it in GitHub Desktop.
Save niklasvh/3171462 to your computer and use it in GitHub Desktop.
<?php
echo "*** Testing token_get_all() : 'source' string with different constants ***\n";
$a = 1;
$b = 0;
$source = array (
// int const
'<?php $a = 1 + 034; $b = $a + 0x3F; ?>',
// float const
'<?php $a = 0.23E-2 + 0.43e2 + 0.5; ?>',
// string const
'<?php $a = "hello ".\'world\'; ?>',
// bool const
"<?php \$a = (\$b)? true : false; ?>",
"<?php \$b = (\$a)? FALSE : TRUE; ?>",
// null const
'<?php $b = null | NULL; ?>'
);
for($count = 0; $count < count($source); $count++) {
echo "-- Iteration ".($count + 1)." --\n";
var_dump( token_get_all($source[$count]));
}
echo "Done"
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment