3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?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() { echo getatr1(); $table_str='<table>'; $table=napln(); foreach($table as $tab) { $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>
based on 4Kk9g
Output for 7.0.0 - 7.2.0
<html> <head> <title>Page Title</title> </head> <body> Fatal error: Uncaught Error: Call to undefined function getatr1() in /in/qDvJ6:44 Stack trace: #0 /in/qDvJ6(64): tabulka() #1 {main} thrown in /in/qDvJ6 on line 44
Process exited with code 255.
Output for 5.3.19 - 5.6.28
<html> <head> <title>Page Title</title> </head> <body> Fatal error: Call to undefined function getatr1() in /in/qDvJ6 on line 44
Process exited with code 255.