Click here to Skip to main content
14,929,864 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm kinda new to php, i was doing function and this syntax error happened

PHP
function invalidUid($username) {
$result;
if (!preg_match("/^[a-zA-Z0-9]*$/"), $username) { #that is line 15
    $result = true;
}
else {
    $result = false;
}
return $result;


What I have tried:

nothing,,,,,,,,,,,,,,,,,,,,,,,,,,,
Posted
Updated 9-Feb-21 7:35am
v2

1 solution

You just need to match up your parentheses:

if (!preg_match("/^[a-zA-Z0-9]*$/", $username))


preg_match takes 2 (or more) parameters.
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900