3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test{function __construct(){$a=array('I','n','i','t','i','a','t','i','n','g',' ','o','n','e',' ','l','i','n','e',' ','c','l','a','s','s','.','.','.','<','b','r',' ','/','>');foreach($a as $b){echo$b;}}function __destruct(){$a=array('<','b','r',' ','/','>','D','e','s','t','r','o','y','i','n','g',' ','t','h','e',' ','c','l','a','s','s','.','.','.');foreach($a as $b){echo$b;}}function testing(){$a=array('T','h','i','s',' ','i','s',' ','a','n',' ','f','u','n','c','t','i','o','n',' ','i','n',' ','t','h','e',' ','o','n','e',' ','l','i','n','e',' ','c','l','a','s','s','.','5','+','5','=','0');$c=0;$d=0;foreach($a as $b){if(is_numeric($b)){if($c==0){$c=$b;echo$b;}elseif($d==0){$d=$b;echo$b;}else{echo($c+$d);}}else{echo$b;}}}}$test=new Test();$test->testing();unset($test);
Output for 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.24 - 5.5.35, 5.6.7 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.10, 7.2.0 - 7.2.33, 7.3.12 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Initiating one line class...<br />This is an function in the one line class.5+5=10<br />Destroying the class...
Output for 4.3.0 - 4.3.11, 4.4.0 - 4.4.9
This is an function in the one line class.5+5=10

preferences:
215.12 ms | 402 KiB | 313 Q