Answers for "explode in php 7.4.28"

PHP
46

php explode

$colors  = "red,blue,green,orange";
$colorsArray = explode(",", $colors);
Posted by: Guest on June-14-2019
2

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;
Posted by: Guest on March-11-2021
2

php explode

$list = "one-two-three";
$sep_char = "-";
// array of all needed items: "one", "two", "three"
$arr = explode($sep_char, $list);
// array of max two items: "one", "two-three"
$arr = explode($sep_char, $list, 2);
Posted by: Guest on February-17-2021

Browse Popular Code Answers by Language