echo and print php ile

echo and print
301
echo and print are language constructs, not functions. This means that they don't require parentheses around the argument like a function does, although you can use them both ways: echo "test" and echo("test"). They output the string representation of a variable, constant, or expression.

Assign the string Joel to the variable $name

$name = "Joel";
Output the value of $name using echo & print

echo $name; #> Joel
print $name; #> Joel
Parentheses are not required, but can be used

echo($name); #> Joel
print($name); #> Joel
Using multiple parameters (only echo)

echo $name, "Smith"; #> JoelSmith
echo($name, " ", "Smith"); #> Joel Smith
print, unlike echo, is an expression (it returns 1), and thus can be used in more places:

print("hey") && print(" ") && print("you"); #> you11
The above is equivalent to:

print ("hey" && (print (" " && print "you"))); #> you11

Yorum yapmak içinOturum Açın yada Kayıt Olun .