+ 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.
2 Réponses
+ 6
This will print "user ":
<?php
$str = "D:/user/data/hot.jpg";
$myarray=explode("/",$str);
echo $myarray[1];
?>
+ 4
If you mean to split the string by delimeter => "/", please see the example code.
https://code.sololearn.com/wws7Pz9q12ZL/?ref=app