+ 1

What will be the output & how?

<? Php $var="I love php"; echo ++$var; ?>

26th May 2017, 7:13 AM
Deepak Yadav
Deepak Yadav - avatar
4 odpowiedzi
+ 3
error, $ and var do not contain spaces 😁 if it's syntax error free, then output is already guven by Deepak
26th May 2017, 7:57 AM
Sachin Artani
Sachin Artani - avatar
+ 1
that was by mistake dude...take it easy sachin
26th May 2017, 10:00 AM
Deepak Yadav
Deepak Yadav - avatar
0
Output is "I love phq". It seems that ++ operator increment the last character in the string. I have tested with few letters, output was like this ---- 'a' => 'b' 'b' => 'c', 'k' => 'l' 'z' => 'aa' I am confused about the output for 'z'. Hope some expert will answer your question ( hopefully i will learn also :) )
26th May 2017, 7:43 AM
Apel Mahmod
Apel Mahmod - avatar
0
I didn't think he placed the spaces intentionally, so I removed those spaces and tested 😴
26th May 2017, 8:41 AM
Apel Mahmod
Apel Mahmod - avatar