adspace
I am trying to assign a variable the value of 0123, but it keeps coming up with a different number, what’s the problem?
Answer Posted / Sukveer Singh Aswal
The issue is that the sequence 0123 is treated as an octal (base-8) number in PHP. To assign the decimal (base-10) value of 123 to a variable, use '0123' enclosed in quotes:
```php
$myVar = '0123';
echo $myVar; // outputs 123
```
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What is the current stable version of php?
What sized websites have you worked on in the past?
hello all, I need some sample placement papers in lion bridge.. can anyone help me?
Explain me is it possible to destroy a cookie?
Name and explain five of the PHP error constants?
What is the difference between htmlentities() and htmlspecialchars()?
What is trait in php?
How to create a web form?
What does $_files means?
Which variable declarations within a class is invalid in php?
What is the current stable version of php? What advance thing in php7?
Write a program using while loop?
How can we extract string "pcds.co.in" from a string "https://info@pcds.co.in" using regular expression of php? More on reg can you explain
What is difference between static and final in php?
How to calculate the difference between two dates using php?