php - How to get last word of the URL (Laravel 5.1) -


this question has answer here:

i want last word of url:

http://localhost:8888/articles/tags/europa 

how make in laravel ? {{url::current()}} i'm getting full url. have tried {{url::current().split('/').last}} error: function split() deprecated

try , use preg_split() instead

example:

$var = 'http://localhost:8888/articles/tags/europa'; $var = preg_split("/\//", 'http://localhost:8888/articles/tags/europa'); array_pop($var ); //removes last 

update

i can't delete because accepted answer please see josh088's answer


Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -