

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
In php, is 123==0123?
The answer is No. This is because 0123 means 123 with base 8 (an octal number) and its equivalent in decimal is 83.
Prefixing a number with 0 indicates that it is an octal (base 8) number. This is similar to the fact that 0x indicates hex (base 16) numbers.
Consider the below lines of code −
Example
var_dump(123); var_dump(0123);
Output
This will produce the following output −
int 123 int 83
This is due to the fact that 0123 is an octal notation (notice the 0 at the beginning), whereas 123 is a decimal number.
Now consider the below code −
Example
var_dump(79); var_dump(079);
Output
This will produce the following output −
int 79 int 7
- Related Questions & Answers
- 123 Number Flip in Python
- What is traits in PHP?
- What is .htaccess in PHP?
- What is method overloading in PHP?
- What is header() function in PHP?
- What is explode() function in PHP?
- What is implode() function in PHP?
- What is dependency injection in PHP?
- What is Exception Handling in PHP ?
- What is Trailing Comma in PHP?
- Is PHP compiled or interpreted?
- What is PHP Output Buffering?
- What is singleton design concept in PHP?
- Is there PHP basename() equivalent in MySQL?
- What is Stringable Interface in PHP 8?
Advertisements