character to intercept problem!
Suppose the string $a=123/frew/4214/fsdf/123/123/dsa; $a is a variable and the content changes.
So, how to intercept the second "/" from the beginning to the bottom, i.e. 123/frew/4214/fsdf/123/
Do not start the number "/" from the front because you are not sure that there are several '/' in front of you, since you know the contents of the second '/' after the next number.
------Solution--------------------
$t = explode ('/', $a);
echo join ('/', Array_slice ($t, 0,-2)). '/';
------Solution--------------------
PHP Code
$a = ' 123/FREW/4214/FSDF/123/123/DSA '; $t = explode ('/', $a); Echo join ('/', Array_slice ($t, 0,-2)). '/';
------Solution--------------------
$a = explode ('/', $a);
$s [count ($s)-1] Try It
------Solution--------------------
$b = Join ('/', Array_slice ($t, 0,-2)). '/';
------Solution--------------------
Hey, is the 6 floor a joke?
$a = ' 123/FREW/4214/FSDF/123/123/DSA ';
$t = explode ('/', $a);
$b =join ('/', Array_slice ($t, 0,-2)). '/';
Echo $b;