Skip to content

Instantly share code, notes, and snippets.

@d30jeff
Created October 29, 2015 16:57
Show Gist options
  • Select an option

  • Save d30jeff/441af97972919076e5a1 to your computer and use it in GitHub Desktop.

Select an option

Save d30jeff/441af97972919076e5a1 to your computer and use it in GitHub Desktop.
Bullshit
<?php
$string = "A,B,C,D,'1,2,3,4,5,6',F,G";
$boom = explode("'", $string)[1];
$new_string = str_replace($boom, "", $string);
foreach (explode(",", $new_string) as $letter) {
if ($letter != "''") {
$array[] = $letter;
} else {
$array[] = $boom;
}
}
echo '<pre>'.print_r($array, true).'</pre>';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment