RE: [PHP] get some part of text

From: Date: Fri, 14 Nov 2003 20:14:34 +0000
Subject: RE: [PHP] get some part of text
Groups: php.general 
Request: Send a blank email to php-general+get-169674@lists.php.net to get a copy of this message
[snip] job_resp errorCode="4194337" description="Originator you" I need to take only errorCode value from this string. I am thinking and thinking and can not find how to to. I can split with "=" but allways erroCode place is changing in the string. [/snip] If the line always begins with job_resp errorCode=" and the error code is always 7 digits long do $myString = "job_resp errorCode=\"4194337\" description=\"Originator you\""; $myErrCode = substr($myString, 20, 7); echo $myErrCode."\n"; Watch the quotes though, they may have to be escaped as above

« previous php.general (#169674) next »