Forum Moderators: coopster

Message Too Old, No Replies

simple php variable question

for a newbie

         

blind

5:35 am on Jun 17, 2003 (gmt 0)

10+ Year Member



hey i have a small prob.

how do i intialise a variable.
i have a variable called $auth
and i want to write a litle something like

if ($auth == ""){
$auth=0; }

so if auth is equal to nothing set to 0
but i cant get this to work. help.

DrDoc

5:50 am on Jun 17, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The simplest way would be to do something like this:

if(!$auth) {
$auth = 0;
}

jatar_k

5:50 am on Jun 17, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



there are a couple

if (empty($auth)) $auth = 0;
if (!isset($auth)) $auth = 0;

blind

6:07 am on Jun 17, 2003 (gmt 0)

10+ Year Member



ah cool works great thanks guys.