Re: get some part of text

From: Date: Fri, 14 Nov 2003 20:36:04 +0000
Subject: Re: get some part of text
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-169678@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] How about this, also... $pos = strpos('errorCode="',$error_message); $error_code = substr($error_message,$pos+11,7); if the error code is always 7 digits. or the good old standby of regular expressions... preg_match('/errorCode="([0-9]+)"/',$error_message,$matches); $matches[1] should contain your code... ---John Holmes...

« previous php.general (#169678) next »