Apr 11, 2005 #1 brownfox Programmer Joined Jan 5, 2003 Messages 173 Location GB Here is my string: Code: (user_id LIKE '%2568%') And I want to get 2568 from that string. Does anyone know how I could do this? T.I.A
Here is my string: Code: (user_id LIKE '%2568%') And I want to get 2568 from that string. Does anyone know how I could do this? T.I.A
Apr 11, 2005 1 #2 cLFlaVA Programmer Joined Jun 14, 2004 Messages 6,450 Location US Code: $string = "(user_id LIKE '%2568%')"; $parts = split( "%", $string ); echo $parts[1]; *cLFlaVA ---------------------------- [tt]a frickin' twelve-gauge, what do you think?[/tt] [URL unfurl="true"]http://www.coryarthus.com/[/url] Upvote 0 Downvote
Code: $string = "(user_id LIKE '%2568%')"; $parts = split( "%", $string ); echo $parts[1]; *cLFlaVA ---------------------------- [tt]a frickin' twelve-gauge, what do you think?[/tt] [URL unfurl="true"]http://www.coryarthus.com/[/url]
Apr 11, 2005 Thread starter #3 brownfox Programmer Joined Jan 5, 2003 Messages 173 Location GB Thanks cLFlaVA! Upvote 0 Downvote
Apr 11, 2005 #4 sylve Programmer Joined Jan 18, 2005 Messages 58 Location CA use strpos() to find out if 2568 occurs in your string. It'll return the position of the first character. It will return false if 2568 isnt there. Code: $result = strpos($yourString, '2568'); preg_match() and strstr() are your alternate choices. Good luck! Upvote 0 Downvote
use strpos() to find out if 2568 occurs in your string. It'll return the position of the first character. It will return false if 2568 isnt there. Code: $result = strpos($yourString, '2568'); preg_match() and strstr() are your alternate choices. Good luck!
Apr 11, 2005 Thread starter #5 brownfox Programmer Joined Jan 5, 2003 Messages 173 Location GB But 2568 is a variable in this case so: $parts = split( "%", $string ); echo $parts[1]; is the perfect answer Upvote 0 Downvote
But 2568 is a variable in this case so: $parts = split( "%", $string ); echo $parts[1]; is the perfect answer