yii2 - How to remove first word from string that ends with forwordslash(/) in php -
$pathinfo = $_server['redirect_url']; this code , return:
/google/agency/create however, need agency/create /google dynamic word.
you can explode url string, unset first value , implode again.
<?php $url = "/google/agency/create"; $exp = explode("/", trim($url, "/")); // trim '/' url , explode unset($exp[0]); // unset first value $final_arr = implode("/", $exp); // form string again print_r($final_arr); ?> output:
agency/create
Comments
Post a Comment