3v4l.org

run code in 300+ PHP versions simultaneously
<?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); ?>
Output for 8.1.0 - 8.1.27, 8.2.0 - 8.2.17, 8.3.0 - 8.3.4
Warning: fopen(): php_network_getaddresses: getaddrinfo for ya.ru failed: System error in /in/EVh57 on line 7 Warning: fopen(http://ya.ru): Failed to open stream: php_network_getaddresses: getaddrinfo for ya.ru failed: System error in /in/EVh57 on line 7 Foo is empty - string Warning: 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 8.0.13 - 8.0.30
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 Warning: 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 8.0.0 - 8.0.12
Warning: fopen(): php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in /in/EVh57 on line 7 Warning: fopen(http://ya.ru): Failed to open stream: php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in /in/EVh57 on line 7 Foo is empty - string Warning: 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 7.0.20, 7.1.5 - 7.1.20, 7.2.0 - 7.2.6, 7.4.0, 7.4.26 - 7.4.33
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 7.2.29 - 7.2.33, 7.3.16 - 7.3.31, 7.4.3 - 7.4.25
Warning: fopen(): php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in /in/EVh57 on line 7 Warning: fopen(http://ya.ru): failed to open stream: php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution 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 7.3.32 - 7.3.33
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 - stringBar is empty too - NULLTestone is empty - integerTesttwo is empty - doubleTestthree is empty - arrayTesttwo is emptyarray
Output for 5.5.0 - 5.5.36, 5.6.0 - 5.6.28, 7.0.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

preferences:
203.42 ms | 402 KiB | 213 Q