3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $list = array( "Data" => "9", "Data Structure" => "10", "Database" => "11", "Creativity" => "12", "Forest" => "13", "Al Pacino" => "14", "Humans" => "15", "Technology" => "16" ); $post = array ('Database', 'Law', 'Tech', 'Creative'); $all_key_values = $all_keys = array(); foreach ($post as $keyword) { foreach ($list as $word=>$num) { $sim_chars = similar_text($keyword, $word); if ($sim_chars/strlen($keyword) > .8 || $sim_chars/strlen($word) > .8) { $all_key_values[] = $num; $all_keys[] = $word; } elseif (stripos($keyword, $word) !== false || strpos($word, $keyword)) { $sll_key_values[] = $num; $all_keys[] = $word; } } } print_r(implode(',', $all_key_values)); echo "\n"; print_r(implode(',', $all_keys));
Output for 5.0.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
9,11,16,12 Data,Database,Technology,Creativity
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: stripos() in /in/R74Tj on line 26
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Fatal error: Call to undefined function: stripos() in /in/R74Tj on line 26
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: stripos() in /in/R74Tj on line 26