How to extract substrings with PHP

Posted by shin on Stack Overflow See other posts from Stack Overflow or by shin
Published on 2010-03-27T10:24:19Z Indexed on 2010/03/27 10:33 UTC
Read the original article Hit count: 336

Filed under:
|
|

PHP beginner's question.

I need to keep image paths as following in the database for the admin backend.

../../../../assets/images/subfolder/myimage.jpg

However I need image paths as follows for the front-end.

assets/images/subfolder/myimage.jpg

What is the best way to change this by PHP?

I thought about substr(), but I am wondering if there is better ways.

Thanks in advance.

© Stack Overflow or respective owner

Related posts about php

Related posts about string