3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class Carro { protected $productos = array (); public function add ( $producto, $cantidad ) { $this->productos[$producto] = $cantidad; } public function what_inside_cart () { $callback = function ( $producto ) { return $producto; } array_walk ( $this->productos, $callback ); } } $mi_carro = new Carro; // Añadir algunos artículos al carro $mi_carro->añadir('mantequilla', 1); $mi_carro->añadir('leche', 3); $mi_carro->añadir('huevos', 6); echo $mi_carro->what_inside_cart ();
Output for 5.4.0 - 5.4.23
Parse error: syntax error, unexpected 'array_walk' (T_STRING) in /in/JS0hW on line 18
Process exited with code 255.
Output for 5.3.0 - 5.3.28
Parse error: syntax error, unexpected T_STRING in /in/JS0hW on line 18
Process exited with code 255.