Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #3640
| Date | 2011-10-31 06:30 -0400 |
|---|---|
| From | bill <nobody@spamcop.net> |
| Newsgroups | comp.lang.php |
| Subject | Re: missing variable |
| References | <-4adnYXjVd2CyjHTnZ2dnUVZ_oudnZ2d@cablespeedmi.com> <j8hrj3$tls$1@news.albasani.net> <BdCdneCS9Orf1zDTnZ2dnUVZ_vGdnZ2d@cablespeedmi.com> <4eadac1b$0$28493$a8266bb1@newsreader.readnews.com> |
| Message-ID | <rfGdnZz2AtZL5TPTnZ2dnUVZ_sKdnZ2d@cablespeedmi.com> (permalink) |
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
Back to comp.lang.php | Previous | Next — Previous in thread | Find similar | Unroll thread
missing variable bill <nobody@spamcop.net> - 2011-10-29 15:42 -0400
Re: missing variable Thomas Mlynarczyk <thomas@mlynarczyk-webdesign.de> - 2011-10-29 23:35 +0200
Re: missing variable bill <nobody@spamcop.net> - 2011-10-30 08:59 -0400
Re: missing variable Denis McMahon <denismfmcmahon@gmail.com> - 2011-10-30 19:57 +0000
Re: missing variable Jerry Stuckle <jstucklex@attglobal.net> - 2011-10-30 19:29 -0400
Re: missing variable Denis McMahon <denismfmcmahon@gmail.com> - 2011-10-31 00:37 +0000
Re: missing variable bill <nobody@spamcop.net> - 2011-10-31 06:30 -0400
csiph-web