PHP - explode url

Viewed 25

I want to separate a string by including '/'

Example:

$str = '/string1/string2/string3/'

Using explode();

$arr = explode('/', $str);

Output from explode();

Array(
     '',
     'string1',
     'string2',
     'string3',
     ''
);

Output i want

Array(
     '/string1',
     '/string2',
     '/string3'
);
0 Answers
Related