About PHP regular expressions $ lid = str_replace ("\ r \ n", "", $ lid); if $ lid gets more than one, what should I do? Please help me & nbsp; thank you if & nbsp; ($ lid = intval ($ row ['id']) & nbsp ;{& lt; option for PHP regular expressions
$ Lid = str_replace ("\ r \ n", "", $ lid );
If $ lid gets more than one, what should I do? Thank you!
If ($ lid = intval ($ row ['id']) {
"Selected =" selected ">
} Else {
?>
">
------ Solution --------------------
If multiple $ lids are obtained, convert $ lid explode into an array, and then loop through the array to gradually compare:
Code:
$ Lid = str_replace ("\ r \ n", "", $ lid );
// Assume that multiple IDs are separated by commas (,).
// Combine $ lid into an array
$ Pai_arr = explode (',', $ lid );
If (! Empty ($ pai_arr )){
// Loop array
Foreach ($ pai_arr as $ lid ){
// Original comparison process
If ($ lid = intval ($ row ['id']) {
"Selected =" selected ">
} Else {
?>
">
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.