function stringtoArray($string = null, $keySep = null, $valSep = null) {
$keySep == '' ? $keySep = '==' : $keySep;
$valSep == '' ? $valSep = '&&' : $valSep;
$chunks = array_chunk(preg_split('/('.$keySep.'|'.$valSep.')/', $string), 2);
$defined = array_combine(array_column($chunks, 0), array_column($chunks, 1));
if (is_array($defined)) {
$output = $defined;
}
else {
$output = '<p>Your string is malformed, here is a use of a define example:</p><p>$string="example'.$keySep.'a thing characteristic of its kind or illustrating a general rule.'.$valSep.'test'.$keySep.'a procedure intended to establish the quality, performance, or reliability of something, especially before it is taken into widespread use.'.$valSep.'demonstrate'.$keySep.'clearly show the existence or truth of (something) by giving proof or evidence."</p>';
}
return $output;
}
Comments