php explode array to string code example

Example 1: explode comma php

$myString = "9,[email protected],8";
$myArray = explode(',', $myString);
print_r($myArray);

Example 2: php implode array

$values = array_map('array_pop', $array);
$imploded = implode(',', $values);

Example 3: explode in php

$str = 'one two three four';
$numbers4 = explode(' ',$str);

Example 4: php implode

$arr = array('Hello','World!','Beautiful','Day!');
echo implode(" ",$arr);
// Outputs: 'Hello World! Beautiful Day!'

Example 5: php implode

$colors = array("red","blue","green");
$colorsCSV= "'".implode("','",$colors)."'";
//$colorsCSV: 'red','blue','green'

Example 6: h:i:s explode in php by ":"

$duartion = explode(":","12:23:34");
$duration_hour = $duration[0];
$duration_minute = $duration[1];
$duration_second = $duration[2];
  
echo $duration_hour." ".$duration_minute." ".$duration_second;

Tags:

Sql Example