Sunday, July 15, 2018

php get substring after character or word


Here we will get substring after word '/'
$item = 'posts/p10504';

substr(strrchr($item, '/'),1);
substr($item , strpos($item , '/') + 1);

//both lines has value of p10504

No comments:

Post a Comment