session - if string begins with "xx" (PHP) -


this question has answer here:

if ($_post['id'] beginswith "gm") { $_session['game']=="gmod" } if ($_post['id'] beginswith "tf2") { $_session['game']=="tf2" } 

how work?

if (strpos($_post['id'], "gm") === 0) {   $_session['game'] ="gmod" } if (strpos($_post['id'],"tf2") === 0) {   $_session['game'] ="tf2" } 

Comments