[Solved] Explode string [ ]

Here’s one way with Javascript. You can split the string using regex. It can output an array and from there you can loop and assign the strings to the variables you need const str = “zoneAdd[1][home][group]” const strArr = str.replace(/[\[\]’]+/g,’ ‘).trim().split(‘ ‘) const task = strArr[0] const id = strArr[1] const place = strArr[2] const … Read more

[Solved] php explode where no spaces etc [closed]

I’m assuming those are location names “France”, “Paris”, “Great Britain”, etc… Here is one possible solution: $places = array(“FR”, “PAR”, “GB”, “ASD”); $string = “FRPARGBASD”; $tokens = array(); while (strlen($string) > 0) { $next_token = “”; $i = 0; while ($next_token == “”) { if (substr($string, 0, strlen($places[$i])) == $places[$i]) { $next_token = $places[$i]; } … Read more

[Solved] php explode on xml file

If what you are looking for is a way to cleanup the corrupt XML file, you can just add the string that gets missing when the explode is run. It is all a bit hackish, but it works. $file=”/Users/jasenburkett/Sites/jobsark/feed.xml”; $data = file_get_contents($file); $split = “</JobSearchResults>”; // Split on this $parts = explode($split, $data); // Make … Read more

[Solved] How to explode row in table? [closed]

Seems like you want to convert String to JavaScript Array. Take a look for Example; $myRowFromTable=”K04, K84, K53, K331, L985″; // Has Array Data $ex = explode (‘, ‘, $myRowFromTable); // print_r($ex); // According to User Expected Result $newFormat = “[‘” . implode(“‘, ‘”, $ex) . “‘]”; echo $newFormat; DEMO 1 solved How to explode … Read more