Re: [PHP] string questions
Try, list($test)=explode(' ',$address); HTH Danny - Original Message - From: webmaster [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, August 02, 2002 5:35 PM Subject: [PHP] string questions I know there has to be an easy way to do this, but I just can't find the answer. I need to strip out the first part of a text string. I've figured out out to strip out the last part of a string using the following: $address = (4455 N. 45th St.); $test = strstr($address, ); echo $test; The variable $test returns N. 45th St. without the 4455. Is there a way to reverse this so I can just return 4455? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] string questions
On Saturday 03 August 2002 00:35, webmaster wrote: I know there has to be an easy way to do this, but I just can't find the answer. I need to strip out the first part of a text string. I've figured out out to strip out the last part of a string using the following: $address = (4455 N. 45th St.); $test = strstr($address, ); echo $test; The variable $test returns N. 45th St. without the 4455. Is there a way to reverse this so I can just return 4455? Use strpos() to find the position of the first space then substr() to extract from beginning to the space. -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* The San Diego Freeway. Official Parking Lot of the 1984 Olympics! */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] string questions
Use function explode, preg_split, split to split the text string. $pieces = explode( , $address); echo $pieces[0]; // will output 4455 - Original Message - From: Jason Wong Sent: Saturday, August 03, 2002 1:12 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] string questions On Saturday 03 August 2002 00:35, webmaster wrote: I know there has to be an easy way to do this, but I just can't find the answer. I need to strip out the first part of a text string. I've figured out out to strip out the last part of a string using the following: $address = (4455 N. 45th St.); $test = strstr($address, ); echo $test; The variable $test returns N. 45th St. without the 4455. Is there a way to reverse this so I can just return 4455? Use strpos() to find the position of the first space then substr() to extract from beginning to the space. -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* The San Diego Freeway. Official Parking Lot of the 1984 Olympics! */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.phpGet more from the Web. FREE MSN Explorer download : http://explorer.msn.com