+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.

php

4/16/2019 7:15:16 AM

sherlockholmes

2 Answers

New Answer

+4

If you mean to split the string by delimeter => "/", please see the example code. https://code.sololearn.com/wws7Pz9q12ZL/?ref=app

+4

This will print "user ": <?php $str = "D:/user/data/hot.jpg"; $myarray=explode("/",$str); echo $myarray[1]; ?>