Menu
Forums
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Trending
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
Upgrades
Log in
Register
What's new
Search
Search
Search titles only
By:
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
Software Development
Programming
Programming Q&A
[PHP] preg_match help
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="NSA" data-source="post: 181934" data-attributes="member: 10034"><p>Hello,</p><p> </p><p>I'm not sure how to explain this, so I'll do my best!</p><p> </p><p>So say I have 4 variables like this (or something like this)</p><p> </p><p>$var[1];</p><p>$var[2];</p><p>$var[3];</p><p>$var[4];</p><p> </p><p>I then want something like this:</p><p> </p><p><span style="font-size: 14px"><span style="font-family: 'Consolas'"><span style="color: #007700">if(</span></span></span><span style="font-size: 14px"><span style="font-family: 'Consolas'"><span style="color: #0000bb">preg_match</span></span></span><span style="font-size: 14px"><span style="font-family: 'Consolas'"><span style="color: #007700">(</span></span></span><span style="font-size: 14px"><span style="font-family: 'Consolas'"><span style="color: #dd0000">'/[^0-9A-Za-z]/'</span></span></span><span style="font-size: 14px"><span style="font-family: 'Consolas'"><span style="color: #007700">,</span></span></span><span style="font-size: 14px"><span style="font-family: 'Consolas'"><span style="color: #0000bb">$var[?]</span></span></span><span style="font-size: 14px"><span style="font-family: 'Consolas'"><span style="color: #007700">)){</span></span></span></p><p> </p><p>echo "error";</p><p>}else{</p><p>login($var[1], $var[2]);</p><p>}</p><p><span style="font-size: 14px"><span style="font-family: 'Consolas'"><span style="color: #007700">So that each variable will be checked without having to write separate if statements for each variable and data will be passed through to the function.</span></span></span></p><p> </p><p> </p><p> </p><p><span style="font-family: 'Consolas'"><span style="color: #007700"><span style="font-size: 14px">How can I do this in PHP?</span></span></span></p></blockquote><p></p>
[QUOTE="NSA, post: 181934, member: 10034"] Hello, I'm not sure how to explain this, so I'll do my best! So say I have 4 variables like this (or something like this) $var[1]; $var[2]; $var[3]; $var[4]; I then want something like this: [SIZE=14px][FONT=Consolas][COLOR=#007700]if([/COLOR][/FONT][/SIZE][SIZE=14px][FONT=Consolas][COLOR=#0000bb]preg_match[/COLOR][/FONT][/SIZE][SIZE=14px][FONT=Consolas][COLOR=#007700]([/COLOR][/FONT][/SIZE][SIZE=14px][FONT=Consolas][COLOR=#dd0000]'/[^0-9A-Za-z]/'[/COLOR][/FONT][/SIZE][SIZE=14px][FONT=Consolas][COLOR=#007700],[/COLOR][/FONT][/SIZE][SIZE=14px][FONT=Consolas][COLOR=#0000bb]$var[?][/COLOR][/FONT][/SIZE][SIZE=14px][FONT=Consolas][COLOR=#007700])){[/COLOR][/FONT][/SIZE] echo "error"; }else{ login($var[1], $var[2]); } [SIZE=14px][FONT=Consolas][COLOR=#007700]So that each variable will be checked without having to write separate if statements for each variable and data will be passed through to the function.[/COLOR][/FONT][/SIZE] [FONT=Consolas][COLOR=#007700][SIZE=14px]How can I do this in PHP?[/SIZE][/COLOR][/FONT] [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Software Development
Programming
Programming Q&A
[PHP] preg_match help
Top