A
A
arkanum2015-10-29 22:38:33
PHP
arkanum, 2015-10-29 22:38:33

How to remove a piece of text from a variable?

I extract part of the URL into the variable: /catalog/cabinet/premium
-
cab
everything to the last slash.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
DevMan, 2015-10-29
@arkanum

preg_replace( '/.*\//', '/', $str );
ideone.com/ueyrif

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question