+ 4

Explain please. Why output is 1111

https://code.sololearn.com/w075Zvs3s12H/?ref=app

5th Jul 2019, 5:41 AM
UraL
10 ответов
+ 7
PHP print statement returns a value of integer type which is always 1, regardless of what argument you give the statement. That’s the source of the extra 1. Read more about echo and print here: https://www.jquery-az.com/php-echo-and-print-statement-with-6-examples/
5th Jul 2019, 8:01 AM
Jennifer Cramer
Jennifer Cramer - avatar
+ 6
Airree maybe
5th Jul 2019, 7:21 AM
UraL
+ 3
It's from PHP challenge
5th Jul 2019, 5:51 AM
UraL
+ 3
It's a function. The dots are not a part of it, it's just to concatinate it with the 2 1's. It just outputs something on a screen, and returns it
5th Jul 2019, 5:52 AM
Airree
Airree - avatar
+ 3
Airree Why print(1) or echo print(1) does not work?
5th Jul 2019, 5:54 AM
UraL
+ 3
Airree Why echo 1 .print(2). 1 is 2111?
5th Jul 2019, 5:57 AM
UraL
+ 3
1. It does work. 2. It doesn't return the number I guess, but 1. So, it will be 2111
5th Jul 2019, 5:59 AM
Airree
Airree - avatar
+ 3
".” the point is a concatenation operation on strings. php considers the “1” as chars and put them together as 111.
5th Jul 2019, 9:27 AM
David Borges Reis e Silva
David Borges Reis e Silva - avatar
+ 2
The print function prints its argument then returns it. So if you think about it, first, you print 1, then you echo 1.1.1, which is 111
5th Jul 2019, 5:44 AM
Airree
Airree - avatar
+ 2
What is .print(1). ?
5th Jul 2019, 5:50 AM
UraL