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
March 2017
M T W T F S S
« Sep    
 12345
6789101112
13141516171819
20212223242526
2728293031  
Follow me on Twitter
Blog Stats
  • 72,827 hits