001 - string or int | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

001 - string or int

$smth = 001 echo $smth is the output of the example 1 or "001"? how can i define smth as string or int?

21st Sep 2016, 6:30 AM
Станислав Панченко
Станислав Панченко - avatar
6 Answers
+ 8
$smth = 001; echo $smth; //prints 1 $smth = "001"; echo $smth; //prints 001
21st Sep 2016, 7:41 AM
Zen
Zen - avatar
+ 1
Output is 001 and it is integer,
22nd Sep 2016, 7:02 AM
vinay
vinay - avatar
0
this is int
25th Sep 2016, 11:33 AM
Yahya housh
Yahya housh - avatar
0
it is a string. if you guys think 001 is an integer then use maths here please with command + you will see output wont be 002and shouldnt be therefore it is a string
17th Oct 2016, 9:38 PM
Alvis Ramons
Alvis Ramons - avatar
0
001 is integer only
26th Oct 2016, 6:09 AM
k.k Amrutha
k.k Amrutha - avatar
- 2
Int is for a WHOLE NUMBER (ex: 0, 1, 2) no decimals 001 is a string
21st Sep 2016, 12:57 PM
Kathleen Ulayao
Kathleen Ulayao - avatar