3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php define('EOL',"\n"); $data='a=1&b=2&c=3'; echo 'global scope',EOL; echo 'parse_data(): ',$data,EOL; parse_str($data); if(isset($b)) { echo 'isset b='.$b,EOL; } else { echo 'no b='.$b,EOL; } echo EOL; echo 'within function',EOL; testme(); function testme() { $data='a=1&b=2&c=3'; echo 'parse_data(): ',$data,EOL; parse_str($data); //echo print_r($b,1); if(isset($b)) { echo 'isset b='.$b,EOL; } else { echo 'notset b='.$b,EOL; } if(isset($b)) { echo 'isset b='.$b,EOL; } else { echo 'no b='.$b,EOL; } }
Output for 4.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
global scope parse_data(): a=1&b=2&c=3 isset b=2 within function parse_data(): a=1&b=2&c=3 isset b=2 isset b=2