note 76591 deleted from control-structures.switch by cmb

From: Date: Sun, 21 Apr 2019 11:47:09 +0000
Subject: note 76591 deleted from control-structures.switch by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-210636@lists.php.net to get a copy of this message
Note Submitter: juraj5 ---- In response to 'i luv spam', when you enter 07, you tell PHP to interpret a number as an octal number (much like '0x' for hex numbers). Octal numbering system uses only 8 digits, i.e. 0-7. http://en.wikipedia.org/wiki/Octal The number 8 does not exist in octal numbering system. The comparison works because the octal numbers 0 to 7 have identical counterparts in decimal system. So, in order to get a number compared as decimal 8, you would have to enter 010 in the case. BTW this behavior obviously isn't specific to switch, it's a part of PHP. (I personally stumbled into this when trying to make my code nicely indented while declaring an array)

« previous php.notes (#210636) next »