3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $foo = ''; $testone = 0; $testtwo = 0.0; $testthree = array(); $testfour = fopen("http://ya.ru", "r"); if(empty($foo)) echo "Foo is empty - ". gettype($foo); // Foo is empty - string if(empty($bar)) echo 'Bar is empty too - '. gettype($bar); // Notice: Undefined variable: bar in /in/kCIj8 on line 7 Bar is empty too - NULL if(empty($testone)) echo 'Testone is empty - '.gettype($testone); if(empty($testtwo)) echo 'Testtwo is empty - '.gettype($testtwo); if(empty($testthree)) echo 'Testthree is empty - '.gettype($testthree); if(empty($testfour)) echo 'Testtwo is empty'.gettype($testthree); else echo "Testfour's not empty -".var_dump($testfour); ?>
based on XZts8
Output for 7.0.20, 7.1.5 - 7.3.0beta1
Warning: fopen(): php_network_getaddresses: getaddrinfo failed: System error in /in/EVh57 on line 7 Warning: fopen(http://ya.ru): failed to open stream: php_network_getaddresses: getaddrinfo failed: System error in /in/EVh57 on line 7 Foo is empty - string Notice: Undefined variable: bar in /in/EVh57 on line 11 Bar is empty too - NULLTestone is empty - integerTesttwo is empty - doubleTestthree is empty - arrayTesttwo is emptyarray
Output for 5.5.0 - 7.0.7, 7.1.0
Warning: fopen(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /in/EVh57 on line 7 Warning: fopen(http://ya.ru): failed to open stream: php_network_getaddresses: getaddrinfo failed: Name or service not known in /in/EVh57 on line 7 Foo is empty - string Notice: Undefined variable: bar in /in/EVh57 on line 11 Bar is empty too - NULLTestone is empty - integerTesttwo is empty - doubleTestthree is empty - arrayTesttwo is emptyarray