ابدأ بالتواصل مع الأشخاص وتبادل معارفك المهنية

أنشئ حسابًا أو سجّل الدخول للانضمام إلى مجتمعك المهني.

متابعة

Any one can explain to me? why it's returning 83?

<p>&lt;?php</p> <p>$k=0123;echo $k;</p> <p>?&gt;</p>

user-image
تم إضافة السؤال من قبل Kamatchi Panneer Selvam , Software Developer , Comtel General Trading LLC
تاريخ النشر: 2014/10/13
Majid Hameed
من قبل Majid Hameed , Senior Java Developer , Check24 Vergleichsportal GmbH

Yes anything that starts with0 is an octal integer.

If you don't want to store string and want to store number then following are2 options.

$k =0123.00;

OR if you want to stick with integer then you can do casting.

$k = (int)0123.00;

Yousef Adel Abdulaziz
من قبل Yousef Adel Abdulaziz , Information Technology Specialist , Takamol Holding

Because it's assigning $k to the octal value of0123 which is83.

0123 =83 in octal

Instead, try to store0123 as a string e.g. $k = "0123";

Julfkar  Moh Umar
من قبل Julfkar Moh Umar , Sr. Software Engineer , Aakash Edutech Private Limited

This is OCTAL Number so this will be calculated as:

 

1*8^2+2*8^1+3*8^0 =

المزيد من الأسئلة المماثلة

هل تحتاج لمساعدة في كتابة سيرة ذاتية تحتوي على الكلمات الدلالية التي يبحث عنها أصحاب العمل؟