3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Car { public $atr1; public $atr2; public $atr3; function _construct($atr1,$atr2,$atr3) { $this->atr1=$atr1; $this->atr2=$atr2; $this->atr3=$atr3; } function getatr1() { return $this->atr1; } function getatr2() { return $this->atr2; } function getatr3() { return $this->atr3; } } function napln() { $obj1 = new Car('renault','modra','nieco'); $obj2 = new Car('skoda','zelena','neviem'); $obj3 = new Car('opel','cervena','cojaviem'); $pole = array($obj1, $obj2, $obj3); return $pole; } function tabulka() { $table_str='<table>'; $table=napln(); foreach($table as $tab) { echo getatr1(); $table_str.= '<tr>'; $table_str.='<td>'.$tab -> getatr1().'</td><td>'.$tab -> getatr2().'</td><td>'.$tab -> getatr3().'</td>'; $table_str.='</tr>'; } $table_str.='</table>'; return $table_str; } ?> <html> <head> <title>Page Title</title> </head> <body> <?php echo tabulka(); ?> </body> </html>
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.25, 7.2.0 - 7.2.33, 7.3.0 - 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
<html> <head> <title>Page Title</title> </head> <body> Fatal error: Uncaught Error: Call to undefined function getatr1() in /in/iTsu7:49 Stack trace: #0 /in/iTsu7(65): tabulka() #1 {main} thrown in /in/iTsu7 on line 49
Process exited with code 255.
Output for 5.5.24 - 5.5.35, 5.6.8 - 5.6.28
<html> <head> <title>Page Title</title> </head> <body> Fatal error: Call to undefined function getatr1() in /in/iTsu7 on line 49
Process exited with code 255.

preferences:
183.12 ms | 402 KiB | 198 Q