Parse error: syntax error, unexpected T_IF, expecting ')' What should I do?

pradeep

Parse error: syntax error, unexpected T_IF, expecting ')'

What should I do? .please anyone help me out

         $option = $_GET['I-would-like'];
         $userdata = array(
            'user_login' => $username,
            'user_pass' => $password,
            'user_email' => $email,
            'nickname' => reset($name_parts),
            'display_name' => $name,
            'first_name' => reset($name_parts),
            'last_name' => end($name_parts),    
            if ($option == 'A quotation' OR  $option == 'Information')// Error occurs here
        {
            'role' => 'customer'
            } else if($option == 'To become a Partner') 
            {
            'role' => 'partners'
            } else if ($option == 'Training / Coaching')
                {
            'role' => 'students'
            }
        );
Dave

try this, get role value outside array

$role = "";
$option = $_GET['I-would-like'];
$option = trim($option);
if ($option == 'A quotation' || $option == 'Information')
{
    $role = 'customer';
} else if($option == 'To become a Partner') 
{
    $role = 'partners';
} else if ($option == 'Training / Coaching')
{
    $role =  'students';
}


$userdata = array(
    'user_login' => $username,
    'user_pass' => $password,
    'user_email' => $email,
    'nickname' => reset($name_parts),
    'display_name' => $name,
    'first_name' => reset($name_parts),
    'last_name' => end($name_parts),    
    'role' => $role
);

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Laravel : Parse error: syntax error, unexpected 'if' (T_IF) on view

What's wrong? PHP Parse error: syntax error, unexpected '}', expecting ',' or ';' in

Parse error: syntax error, unexpected 'layouts' (T_STRING), expecting ',' or ')

Parse error: syntax error, unexpected 'text' (T_STRING), expecting ',' or ';'

Parse error: syntax error, unexpected T_VARIABLE, expecting ',' or ';'

Parse error: syntax error, unexpected T_STRING, expecting ']'

Parse error: syntax error, unexpected 'href' (T_STRING), expecting ',' or ';'

Parse error: syntax error, unexpected '|', expecting variable (T_VARIABLE)

parse error: syntax error, unexpected '<', expecting ')'

Parse error: syntax error, unexpected '=', expecting ',' or ';'

Parse error: syntax error, unexpected '}', expecting ',' or ';' in /

Parse error: syntax error, unexpected 'if' (T_IF), expecting ')' in D:\xampp\htdocs\ramesh\wmw\catalog\controller\product\sub_category.php on line 29

What am I doing wrong - syntax error unexpected '\n', expecting =>

Syntax error, unexpected T_IF in my script

PHP parse error (unexpected T_IF)

syntax error, unexpected |=, expecting '}'

syntax error, unexpected ',', expecting ']'

Syntax error: "(" unexpected (expecting "then")

syntax error, unexpected '}', expecting ')'

syntax error, unexpected '=', expecting ')'

Fatal error - Parse error: syntax error, unexpected ':', expecting - Wordpress

Error : ( ! ) Parse error: syntax error, unexpected '' (T_ENCAPSED_AND_WHITESPACE), expecting identifier (T_STRING)

production.ERROR: Parse error: syntax error, unexpected '?', expecting variable (T_VARIABLE)

Contact Form 7 - Error on activation Parse error: syntax error, unexpected '.', expecting '&' or variable (T_VARIABLE)

SELECT execute([]) Parse error: syntax error, unexpected '[', expecting ')' in

Parse error: syntax error, unexpected '[', expecting ')', possibly PHP version issue

PHP Parse error: syntax error, unexpected end of file, expecting '`'

Wordpress plugin PHP Parse error: syntax error, unexpected '{', expecting ')'

Parse error: syntax error, unexpected '(', expecting ',' or ';' Smarty PHP