php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #7539 switch statement only process first 7 cases and default
Submitted: 2000-10-30 19:01 UTC Modified: 2000-10-30 19:10 UTC
From: razno at siteop dot org Assigned:
Status: Closed Package: Unknown/Other Function
PHP Version: 4.0.3pl1 OS: Redhat 7
Private report: No CVE-ID: None
 [2000-10-30 19:01 UTC] razno at siteop dot org
#### EXAMPLE:
switch ($rubrika) {
 case 01: $rubrika = "showbiz"; break;
 case 02: $rubrika = "politika"; break;
 case 03: $rubrika = "sport"; break;
 case 04: $rubrika = "avto"; break;
 case 05: $rubrika = "zabava"; break;
 case 06: $rubrika = "ljubezen"; break;
 case 07: $rubrika = "zdravje"; break;
 case 08: $rubrika = "znanost"; break;
 case 09: $rubrika = "racunalnistvo"; break;
 default: $rubrika = "racunalnistvo";
}
#### PHP COMPILE LINE
./configure --with-apache=../apache_1.3.12 --enable-track-vars --with-mysql --with-gdlib  --with-imap=/test/imap-4.7b/c-client

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-10-30 19:10 UTC] torben@php.net
This is not a bug in PHP--you're using octal numbers, (an integer
prefixed with a 0 is octal in PHP). Since octal digits only go up to 07,
you're hitting the ceiling there.

Remove the 0's from the beginnings of the numbers and it should
work as you expect.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Oct 22 15:01:29 2024 UTC