Making function for php condition statement -


i'm new php, i'm making online cart website in php admin panels, i've 3 type of users 1: admin (all roles) 2: sellers (who sell items) 3: customers/buyers (who buy items)

          function user_access($user){         $_session['access'] == '$user';         return $user;     }       if(user_access('admin')){         echo "you logged in admin";     } else { echo "undefine access"; }   

but outpul same :( how can make functions type of conditions, wordpress.

sorry bad english,

this:

function user_access($user){     $_session['access'] == '$user';     return $user; } 

should just:

function user_access($user){     return $_session['access'] == $user; } 

so, need remove quotes around $user, , return result of comparison, not $user variable.


Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

Function that returns a formatted array in VBA -