Categories:
.NET (357)
C (330)
C++ (183)
CSS (84)
DBA (2)
General (7)
HTML (4)
Java (574)
JavaScript (106)
JSP (66)
Oracle (114)
Perl (46)
Perl (1)
PHP (1)
PL/SQL (1)
RSS (51)
Software QA (13)
SQL Server (1)
Windows (1)
XHTML (173)
Other Resources:
Octal and Decimal Numbers
I am trying to assign a variable the value of 0123, but it keeps coming up with a different number, what's the problem?
✍: FYIcenter
If you assign a variable with a value of 0123, PHP will interpret as an octal number resulting to decimal value of 83.
All numbers that preceded with a 0 (zero) will be interpreted as octabl numbers. This is one of the PHP literal data rules. For example, the PHP script below will produce: 83 and 123.
<?php $octal = 0123; // octal number (equivalent to 83 decimal) $decimal = 123; // decimal number echo $octal ."\n"; echo $decimal ."\n"; ?>
2007-02-27, 9936👍, 0💬
Popular Posts:
.NET INTERVIEW QUESTIONS - How can you avoid deadlock in threading? A good and careful planning can ...
How To Delete a User Account? - Oracle DBA FAQ - Managing Oracle User Accounts, Schema and Privilege...
What is CAR (Causal Analysis and Resolution)? The basic purpose of CAR is to analyze all defects, pr...
What Is the Text Paragraph Formatting Model? - CSS Tutorials - HTML Formatting Model: Block, Inline ...
How To Define a Data Source Name (DSN) in ODBC Manager? - Oracle DBA FAQ - ODBC Drivers, DSN Configu...