3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $text = "brand => toyota,type => suv, color => white"; $result = []; array_walk(explode(',',$text),function($v)use(&$result){ $res = explode("=>",$v); $result[trim($res[0])] = trim($res[1]); }); print_R($result);
Output for 7.0.0 - 7.2.0
Notice: Only variables should be passed by reference in /in/KH6bZ on line 5 Array ( [brand] => toyota [type] => suv [color] => white )
Output for 5.4.12 - 5.6.28
Strict Standards: Only variables should be passed by reference in /in/KH6bZ on line 5 Array ( [brand] => toyota [type] => suv [color] => white )
Output for 5.3.22 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/KH6bZ on line 4
Process exited with code 255.