3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function get_position($string) { $vowels = array("a,e,i,o,u"); $first_letter = strtolower(substr($string,0,1)); echo $first_letter."<br>"; print_r($vowels); $new_string = ""; if( in_array($vowels,$first_letter) ) { $new_string = "an <strong>".ucfirst($string)."</strong>"; } else { $new_string = "a <strong>".ucfirst($string)."</strong>"; } return $new_string; } $output1 = get_position("Advertising"); $output2 = get_position("Marketing"); echo $output1."<br>"; echo $output2."<br>";
Output for 5.3.0 - 5.6.28, 7.0.0 - 7.1.0
a<br>Array ( [0] => a,e,i,o,u ) Warning: in_array() expects parameter 2 to be array, string given in /in/RkKTh on line 9 m<br>Array ( [0] => a,e,i,o,u ) Warning: in_array() expects parameter 2 to be array, string given in /in/RkKTh on line 9 a <strong>Advertising</strong><br>a <strong>Marketing</strong><br>
Output for hhvm-3.12.0
a<br>Array ( [0] => a,e,i,o,u ) Warning: in_array() expects parameter 2 to be an array or collection in /in/RkKTh on line 9 m<br>Array ( [0] => a,e,i,o,u ) Warning: in_array() expects parameter 2 to be an array or collection in /in/RkKTh on line 9 a <strong>Advertising</strong><br>a <strong>Marketing</strong><br>
Output for hhvm-3.10.0

Process exited with code 153.
Output for 4.3.2 - 5.2.17
a<br>Array ( [0] => a,e,i,o,u ) Warning: in_array(): Wrong datatype for second argument in /in/RkKTh on line 9 m<br>Array ( [0] => a,e,i,o,u ) Warning: in_array(): Wrong datatype for second argument in /in/RkKTh on line 9 a <strong>Advertising</strong><br>a <strong>Marketing</strong><br>
Output for 4.3.0 - 4.3.1
a<br>Array ( [0] => a,e,i,o,u ) Warning: in_array() [http://www.php.net/function.in-array]: Wrong datatype for second argument in /in/RkKTh on line 9 m<br>Array ( [0] => a,e,i,o,u ) Warning: in_array() [http://www.php.net/function.in-array]: Wrong datatype for second argument in /in/RkKTh on line 9 a <strong>Advertising</strong><br>a <strong>Marketing</strong><br>