I am working on my PHP script to fetch the strings by using explode so I can store the strings into the array. I have got a problem with my code because when I split the strings to store them into the array, I will get like this:
Array ( [0] => [1] => 0.1 noname.gif [2] => 0.2 what-is-bootstrap.png )
Here is what it should be:
Array ( [0] => 0.1 noname.gif [1] => 0.2 what-is-bootstrap.png)
Here is what it show in the results:
attid: 0.1 filename: noname.gif
attid: 0.2 filename: what-is-bootstrap.png
Here is the code:
<?php
$attached = 'attid: 0.1 filename: noname.gif
attid: 0.2 filename: what-is-bootstrap.png';
$attached_files = explode('attid:', $attached);
$attached_files = str_replace('filename:', '', $attached_files);
?>
I don't know how to store the strings into the array with each key like 0 and 1.
Can you please show me an example how I can store the strings into the array when I split the strings?