Daily Archives: October 23, 2013

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 Tutorial on WordPress.com
categories
Calendar
October 2013
M T W T F S S
 123456
78910111213
14151617181920
21222324252627
28293031  
Follow me on Twitter
Blog Stats
  • 88,191 hits