[Solved] How to use explode function in PHP without delimeters


You can access a variable as you can access an array, if you were to echo:

$string = "test";
echo $string[0];

It would echo t, and onwards.

You could concat the string and make a new variable like:

$v = "0904201600000123";
$date = $v[0].$v[1].'-'.$v[2].$v[3].'-'.$v[4].$v[5].$v[6].$v[7];
echo $date;

I tested it on my local machine and it worked

Note: If you want to use the method using the explode function as I saw you did earlier, you could use the str_split function which will instead make the result an array.

4

solved How to use explode function in PHP without delimeters