3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $nombre_tabla = 'princesscruceros' ; switch($nombre_tabla) { case 'princesscruceros': $sql = ["ALTER TABLE `princesscruceros` ADD INDEX ( `codigo_de_crucero` ) ;", "ALTER TABLE `princesscruceros` ADD INDEX ( `codigo_de_barco` ) ;" ]; break; case 'princessitinerarios': $sql = ["ALTER TABLE `princessitinerarios` ADD INDEX ( `codigo_puerto` ) ;", "ALTER TABLE `princessitinerarios` ADD INDEX ( `codigo_de_crucero` ) ;", "ALTER TABLE `princessitinerarios` ADD INDEX ( `nombre_del_crucero` ) ;" ]; break; case 'princesscodigosdepuertos': $sql = ["ALTER TABLE `princesscodigosdepuertos` ADD INDEX ( `codigo_de_puerto` ) ;"]; break; } var_dump($sql);
Output for 5.4.0 - 7.1.0
array(2) { [0]=> string(68) "ALTER TABLE `princesscruceros` ADD INDEX ( `codigo_de_crucero` ) ;" [1]=> string(66) "ALTER TABLE `princesscruceros` ADD INDEX ( `codigo_de_barco` ) ;" }
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/V7t6H on line 6
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1, 5.0.0 - 5.0.5
Parse error: parse error, unexpected '[' in /in/V7t6H on line 6
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/V7t6H on line 6
Process exited with code 255.