[PHP-DB] Character check in string
Is there a php function to check if a string contains a certain kind of character and is there a function to split up a string? e.g. $data = 13_45 I want to check if variable $data contains the character _. If that's the case I want to split the variable (array or seperate variables) so I've got a variable containing 13 and one containing 45. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Character check in string
This should get you started. http://www.php.net/manual/en/function.split.php There are other ones too, like explode. -Natalie -Original Message- From: Prodoc [mailto:[EMAIL PROTECTED]] Sent: Monday, May 20, 2002 1:00 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Character check in string Is there a php function to check if a string contains a certain kind of character and is there a function to split up a string? e.g. $data = 13_45 I want to check if variable $data contains the character _. If that's the case I want to split the variable (array or seperate variables) so I've got a variable containing 13 and one containing 45. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Character check in string
Check strstr explode functions HTH Regards - Original Message - From: Prodoc [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, May 20, 2002 6:59 PM Subject: [PHP-DB] Character check in string Is there a php function to check if a string contains a certain kind of character and is there a function to split up a string? e.g. $data = 13_45 I want to check if variable $data contains the character _. If that's the case I want to split the variable (array or seperate variables) so I've got a variable containing 13 and one containing 45. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Character check in string
Try this: $data = 13_45; if (stristr($data,_)) { list($a,$b)=split(_,$data); echo $a; echo br; echo $b; } Cami - Original Message - From: Prodoc [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, May 20, 2002 5:59 PM Subject: [PHP-DB] Character check in string Is there a php function to check if a string contains a certain kind of character and is there a function to split up a string? e.g. I want to check if variable $data contains the character _. If that's the case I want to split the variable (array or seperate variables) so I've got a variable containing 13 and one containing 45. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php