3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php if(!function_exists('array_combine')) { function array_combone($keyarray, $valuearray) { $_ret = array(); foreach($keyarray as $index => $key) $_ret[$key]=$valuearray[$index]; return $_ret; } } $stylestr = 'text-align:center;display:block;'; $_style = array(); preg_match_all('#(.*?):(.*?);#', $stylestr, $matches); //foreach($matches[1] as $index => $key) $_style[$key]=$matches[2][$index]; $_style = array_combine($matches[1], $matches[2]); var_dump($_style);
based on PRvbn
Output for 5.0.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
array(2) { ["text-align"]=> string(6) "center" ["display"]=> string(5) "block" }
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: array_combine() in /in/aXETf on line 13
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Fatal error: Call to undefined function: array_combine() in /in/aXETf on line 13
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: array_combine() in /in/aXETf on line 13