FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » missing variable
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: missing variable [message #175857 is a reply to message #175845] Mon, 31 October 2011 10:30 Go to previous message
bill is currently offline  bill
Messages: 310
Registered: October 2010
Karma:
Senior Member
On 10/30/2011 3:57 PM, Denis McMahon wrote:
> On Sun, 30 Oct 2011 08:59:44 -0400, bill wrote:
>
>> if ($ptNum == "empty") return // do nothing, do not need to
>> create an empty appointment, as there is already an identical one
>> $hist = "empty appointment filled ". nowUS() ." by "
>> .$_SESSION['current_user'] . "\n";
>
> No ";" after the preceding "return"
>
> so without the $hist=""; line what you have is:
>
> if ($ptNum == "empty") return $hist = "empty appointment filled ". nowUS
> () ." by " .$_SESSION['current_user'] . "\n";
>
> In other words, the first $hist value after the return is only defined if
> it's being returned from the function, because it comes between the if
> ($ptNum == "empty") and the next ";"
>
> The // only creates comments to the end of line, it doesn't terminate the
> return
>
> So your if statement assigns the $hist value and immediately uses it as
> the return value, when what you want is to assign the value if you didn't
> return.
>
> Rgds
>
> Denis McMahon

Good catch. Thank you so much !
bill
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: json and special chars
Next Topic: integer and string what's the difference ?
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Fri Nov 08 21:15:19 GMT 2024

Total time taken to generate the page: 0.05182 seconds