<?php
function parse($args)
{
$jobArgs = [];
$list = explode(',', $args);
foreach ($list as $item)
{
$splitArg = explode('=', $item);
$jobArgs[$splitArg[0]] = $splitArg[1];
}
return $jobArgs;
}
function parse2($args)
{
$jobArgs = [];
$list = str_replace(',', '&', $args);
return parse_str($list);
}
var_dump(parse("one=test,two=another,three=win"));
var_dump(parse2("one=test,two=another,three=win"));
preferences:
58.44 ms | 402 KiB | 5 Q