Home » Php » explode – Can someone help me t understand this PHP code

explode – Can someone help me t understand this PHP code

Posted by: admin February 25, 2020 Leave a comment

Questions:

I am working from an existing project and hit a road block

I am trying to understand the following

$list = "" . substr($data, $start,$length) . "";
$new_list = explode("|" , $list);

Yes $start and $length are set, that is not the concern.

I need to try to understand the “double double quotes dot” and “dot double double quotes” and their implications on the php explode command that follows.

Is this simply saying that $list contents will be like this?

" . <Content here> . "

I did not think concatenate “.” was ever used with double quotes.

Thanks for any help

How to&Answers:

dot is only for concatination of string.
double double quotes is empty string.

explode makes an array from string.

$list = "aaaa|bbbb|cccc";
$new_list = explode("|" , $list);

Result:

array("aaaa","bbbb","cccc");

look at php.net. there are samples too.