Blog Archives

extract or get first string from current url in php


$url =”$_SERVER[‘REQUEST_URI’]”; or $url=”https://ephptutorial.wordpress.com/category/internal-messaging-system-in-codeigniter/”; $path = $url); $newpath = $path[‘path’]; $new = explode(‘/’,$newpath); echo $new[2];// Result: category

Tagged with: , , , , , , ,
Posted in extract or get first string from current url in php
Follow php tutorial on WordPress.com
categories
Calendar
July 2017
M T W T F S S
« Sep    
 12
3456789
10111213141516
17181920212223
24252627282930
31  
Follow me on Twitter
Blog Stats
  • 74,622 hits