3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $words = "systematic,gear,synthesis,mysterious"; $words=explode(",",$words); $your_array = preg_grep('~(?=[^s]*s)(?=[^m]*m)(?=[^e]*e)~', $words);; foreach ($words as $w) { if (strpos($words, array('s', 'e', 'm')) == 0) { echo $w; } } print_r($your_array);
Output for 5.4.35 - 7.2.0
Warning: strpos() expects parameter 1 to be string, array given in /in/MM0US on line 9 systematic Warning: strpos() expects parameter 1 to be string, array given in /in/MM0US on line 9 gear Warning: strpos() expects parameter 1 to be string, array given in /in/MM0US on line 9 synthesis Warning: strpos() expects parameter 1 to be string, array given in /in/MM0US on line 9 mysteriousArray ( [0] => systematic [3] => mysterious )
Output for 4.3.0 - 5.0.4
Notice: Array to string conversion in /in/MM0US on line 9 systematic Notice: Array to string conversion in /in/MM0US on line 9 gear Notice: Array to string conversion in /in/MM0US on line 9 synthesis Notice: Array to string conversion in /in/MM0US on line 9 mysteriousArray ( [0] => systematic [3] => mysterious )