DarkPrince2005 Posted December 12, 2009 Share Posted December 12, 2009 Howzit phpFreaks I'm currently trying to build a module for Joomla... I'm building a query that uses the $_GET function to get the viewed articles id... it works fine except for the following problem on certain links. /index.php?option=com_content&view=article&id=2:lorem-ipsum&catid=3:site-content It gets the entire '2:lorem-ipsum' value when i only want the 2... Is there a way to just extract the numbers? Thanx in advance Link to comment https://forums.phpfreaks.com/topic/184903-_get-trim/ Share on other sites More sharing options...
oni-kun Posted December 12, 2009 Share Posted December 12, 2009 Roughly: $id = $_GET['ID']; $id = explode(':', $id); echo $id[0]; // echos 2, id[1] = lorem-ipsum Not sure it's 100% correct, I'm tired. explode Link to comment https://forums.phpfreaks.com/topic/184903-_get-trim/#findComment-976102 Share on other sites More sharing options...
ngreenwood6 Posted December 12, 2009 Share Posted December 12, 2009 you can use the explode function(): $string = '2:lorem-ipsum'; $explode = explode(':',$string); echo $explode[0]; //prints 2 echo $explode[1]; //prints lorem-ipsum Link to comment https://forums.phpfreaks.com/topic/184903-_get-trim/#findComment-976103 Share on other sites More sharing options...
oni-kun Posted December 12, 2009 Share Posted December 12, 2009 you can use the explode function(): $string = '2:lorem-ipsum'; $explode = explode(':',$string); echo $explode[0]; //prints 2 echo $explode[1]; //prints lorem-ipsum My post was verbatim and more relavent, Oh whatever. Link to comment https://forums.phpfreaks.com/topic/184903-_get-trim/#findComment-976104 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.