3v4l.org

run code in 200+ 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 7.2.0
global scope parse_data(): a=1&b=2&c=3 Deprecated: parse_str(): Calling parse_str() without the result argument is deprecated in /in/9JZRK on line 8 isset b=2 within function parse_data(): a=1&b=2&c=3 Deprecated: parse_str(): Calling parse_str() without the result argument is deprecated in /in/9JZRK on line 22 isset b=2 isset b=2
Output for 4.3.0 - 7.1.10
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