+ 3

how to split string into array in php?

for example, i have a string variable : $str = "D:/user/data/hot.jpg"v note : i've use function "split(), explode()" but it does not work.

16th Apr 2019, 7:15 AM
sherlockholmes
sherlockholmes - avatar
2 odpowiedzi
+ 6
This will print "user ": <?php $str = "D:/user/data/hot.jpg"; $myarray=explode("/",$str); echo $myarray[1]; ?>
16th Apr 2019, 7:45 AM
Javier Felipe Toribio
Javier Felipe Toribio - avatar
+ 4
If you mean to split the string by delimeter => "/", please see the example code. https://code.sololearn.com/wws7Pz9q12ZL/?ref=app
16th Apr 2019, 7:39 AM
TheWh¡teCat 🇧🇬
TheWh¡teCat 🇧🇬 - avatar