Answer the question
In order to leave comments, you need to log in
How to split text correctly?
Hello, there is text:
img32.jpg | img75.jpg
img72.jpg | img01.jpg
...
img77.jpg | img80.jpg
array(
'0' => array(
'1' => 'img32.jpg',
'2' => 'img75.jpg',
),
'1' => array(
'1' => 'img72.jpg',
'2' => 'img01.jpg',
),
...
'N' => array(
'1' => 'img77.jpg',
'2' => 'img80.jpg',
),
)
Answer the question
In order to leave comments, you need to log in
$result = array();
$lines = explode("\n", $text);
foreach($lines as $line){
$elems = explode(" | ", $line);
array_push($result, array($elems[0], $elems[1]));
}
Still, toaster-driven development is unbeatable.
It is based on the desperate desire of shitcoders to assert themselves by proving to others that they can write shitcode too! It is for this tender place that lazy beggars take them.
At the same time, no one mastered the regular season :)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question