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 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) { $table_str.= '<tr>'; $table_str.='<td>'.$tab -> $atr1.'</td><td>'.$tab -> $atr2.'</td><td>'.$tab -> $atr3.'</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 7V8fH
Output for 7.1.0 - 7.2.0
<html> <head> <title>Page Title</title> </head> <body> Notice: Undefined variable: atr1 in /in/0kMNd on line 32 Notice: Undefined property: Car::$ in /in/0kMNd on line 32 Notice: Undefined variable: atr2 in /in/0kMNd on line 32 Notice: Undefined property: Car::$ in /in/0kMNd on line 32 Notice: Undefined variable: atr3 in /in/0kMNd on line 32 Notice: Undefined property: Car::$ in /in/0kMNd on line 32 Notice: Undefined variable: atr1 in /in/0kMNd on line 32 Notice: Undefined property: Car::$ in /in/0kMNd on line 32 Notice: Undefined variable: atr2 in /in/0kMNd on line 32 Notice: Undefined property: Car::$ in /in/0kMNd on line 32 Notice: Undefined variable: atr3 in /in/0kMNd on line 32 Notice: Undefined property: Car::$ in /in/0kMNd on line 32 Notice: Undefined variable: atr1 in /in/0kMNd on line 32 Notice: Undefined property: Car::$ in /in/0kMNd on line 32 Notice: Undefined variable: atr2 in /in/0kMNd on line 32 Notice: Undefined property: Car::$ in /in/0kMNd on line 32 Notice: Undefined variable: atr3 in /in/0kMNd on line 32 Notice: Undefined property: Car::$ in /in/0kMNd on line 32 <table><tr><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr></table> </body> </html>
Output for 7.0.0 - 7.0.20
<html> <head> <title>Page Title</title> </head> <body> Notice: Undefined variable: atr1 in /in/0kMNd on line 32 Fatal error: Uncaught Error: Cannot access empty property in /in/0kMNd:32 Stack trace: #0 /in/0kMNd(46): tabulka() #1 {main} thrown in /in/0kMNd on line 32
Process exited with code 255.
Output for 5.5.0 - 5.6.28
<html> <head> <title>Page Title</title> </head> <body> Notice: Undefined variable: atr1 in /in/0kMNd on line 32 Fatal error: Cannot access empty property in /in/0kMNd on line 32
Process exited with code 255.