Re: [PHP] switch case madness

2011-01-18 Thread Chen Dong
Hi,

If it is a string 0, you should use: case 0.
Because in PHP, 0 == false == null. You need to know the difference between
== and ===.

Regards,
Dong Chen

On Wed, Jan 19, 2011 at 2:30 PM, Donovan Brooke li...@euca.us wrote:

 Hello,

 I must not understand PHP's switch/case..
 The case '0' below fires when $t_mssg =  apparently.
 Is this how it's suppose to work? I would think
 it would only fire if it equaled 0.

 --
 print -$t_mssg- br /;

 if (isset($t_mssg)) {
  switch ($t_mssg) {
case 0:
  echo 'pspan style=color:red;Log In Successful/span/p';
  break;
  }
 }
 --

 TIA,
 Donovan

 --
 D Brooke

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




-- 
Regards,
CHEN Dong


Re: [PHP] HTML errors

2011-01-11 Thread Chen Dong
Hi David:

Quote your attribute value in ...

On Wed, Jan 12, 2011 at 2:35 PM, David McGlone da...@dmcentral.net wrote:

 Hi Everyone, I'm having a problem validating some links I have in a
 foreach.
 Here is my code:
  !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN
 http://www.w3.org/TR/html4/loose.dtd;

 my PHP code:
 $categorys = array('home', 'services', 'gallery', 'about_us', 'contact_us',
 'testimonials');
 foreach($categorys as $category){
 $replace = str_replace(_,  , $category);
 echo lia href='index.php?page=$category'$replace/a/li;
 }

 Validator Error:
 an attribute value must be a literal unless it contains only name
 characters

 …omehome/a/lilia
 href=index.php?page=servicesservices/a/lilia
 h…

 I have tried various combinatons and different doctypes. I'm beginning to
 wonder if this code is allowed at all.


 --
 Blessings
 David M.

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




-- 
Regards,
CHEN Dong