3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class ConectorDatos { static function buscarProductos() { return array( 'Hom' => array( '1VX' => 649.95), 'Sam' => array( 'Note2' => 699.95, 'Gala' => 499.95, 'Gel' => 249.95), 'olivi' => array( 'Lumia' => 999.95), 'Obvow' => array( 'One Plus One' => 299.50) ); } } ?> $productos = ConectorDatos::buscarProductos(); <div id="productos"> <ul class="telefonoEspecifico"> <li>Marca:<?php echo $producto['Hom']['1VX'];?></li> <select name="marc" id="marc4"> <?php foreach($productos as $producto) { echo "<option value='2'>".$producto['Sam']['Note2'] . "</option>"; echo "<option value='3'>".$producto['Sam']['Gala'] . "</option>"; echo "<option value='4'>".$producto['Sam']['Gel'] . "</option>"; } ?> </select> <li>Modelo:<?php echo $producto['olivi']['Lumia'];?></li> <li>Precio:<?php echo $producto['Obvow']['One Plus One'];?></li>
based on A6NIE
Output for 5.1.0 - 7.2.6
$productos = ConectorDatos::buscarProductos(); <div id="productos"> <ul class="telefonoEspecifico"> <li>Marca: Notice: Undefined variable: producto in /in/HGiJ4 on line 19 </li> <select name="marc" id="marc4"> Notice: Undefined variable: productos in /in/HGiJ4 on line 23 Warning: Invalid argument supplied for foreach() in /in/HGiJ4 on line 23 </select> <li>Modelo: Notice: Undefined variable: producto in /in/HGiJ4 on line 30 </li> <li>Precio: Notice: Undefined variable: producto in /in/HGiJ4 on line 31 </li>
Output for 5.0.4 - 5.0.5
$productos = ConectorDatos::buscarProductos(); <div id="productos"> <ul class="telefonoEspecifico"> <li>Marca: Notice: Undefined variable: producto in /in/HGiJ4 on line 19 </li> <select name="marc" id="marc4"> Warning: Invalid argument supplied for foreach() in /in/HGiJ4 on line 23 </select> <li>Modelo: Notice: Undefined variable: producto in /in/HGiJ4 on line 30 </li> <li>Precio: Notice: Undefined variable: producto in /in/HGiJ4 on line 31 </li>
Output for 5.0.0 - 5.0.3
$productos = ConectorDatos::buscarProductos(); <div id="productos"> <ul class="telefonoEspecifico"> <li>Marca: Notice: Undefined variable: producto in /in/HGiJ4 on line 19 </li> <select name="marc" id="marc4"> Warning: Invalid argument supplied for foreach() in /in/HGiJ4 on line 23 </select> <li>Modelo: Notice: Undefined variable: producto in /in/HGiJ4 on line 30 </li> <li>Precio: Notice: Undefined variable: producto in /in/HGiJ4 on line 31 </li>
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STATIC, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/HGiJ4 on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected T_STATIC, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/HGiJ4 on line 3
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in /in/HGiJ4 on line 3
Process exited with code 255.