3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $array = unserialize('a:3:{i:0;a:2:{s:8:"frage_id";s:1:"3";s:7:"antwort";s:1:"3";}i:1;a:2:{s:8:"frage_id";s:1:"4";s:7:"antwort";s:1:"3";}i:2;a:2:{s:8:"frage_id";s:1:"5";s:7:"antwort";s:1:"3";}}'); $keys = array_column($array, "frage_id"); $values = array_column($array, "antwort"); $prepend_func = function($value) { return "s" . $value; }; $keys = array_map($prepend_func, $keys); $combined = array_combine($keys, $values); print_r($combined);
Output for 5.5.24 - 5.6.21, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
Array ( [s3] => 3 [s4] => 3 [s5] => 3 )
Output for 5.3.0 - 5.4.45
Fatal error: Call to undefined function array_column() in /in/kHtsn on line 5
Process exited with code 255.
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.2.17
Parse error: syntax error, unexpected T_FUNCTION in /in/kHtsn on line 8
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 T_FUNCTION in /in/kHtsn on line 8
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/kHtsn on line 8
Process exited with code 255.