Forum Moderators: coopster & phranque

Message Too Old, No Replies

what does this code do?

what does this code do?

         

lindajames

3:29 pm on Apr 1, 2003 (gmt 0)

10+ Year Member



Hello, i have this code in on of my scripts:

$str = undef;
if ($payphone ne undef) { $str = "<br>Phone: $payphone"; }
if ($payfax ne undef) { $str = $str . "<br>Fax: $payfax"; }
if ($payemail ne undef) { $str = $str . "<br>Email: $payemail"; }
if ($str ne undef) { bodyprint("$str"); }

I actually removed all the code and just made it like this:

<br>Phone: $payphone
<br>Fax: $payfax
<br>Email: $payemail

and it still seems to work. So, what i confused about is, since it works like this what was the purpose of that code? and will there be any problems the way ive left it?

any comments would be much appreciated.

cheers
linda

Gibble

3:43 pm on Apr 1, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If for whatever reason $payphone, $payfax or $payemail are undefined the prior code checked for this and didn't write out a line with just "Phone: " like your code will.