Verification: a143cc29221c9be0

Output a variable in php

Содержание

PHP Echo Statement

The echo statement can be used to output text, variables, HTML markup, Javascript code, and any other kind of text. Also, echo statement can output values of PHP variables and constants (We already did that in previous examples).

PHP Echo Example - Output Text


I love PHP"; // html markup
echo "I am learning PHP at Hyvor Developer 
"; echo "PHP: " . "Hypertext Preprocesser" . "
"; // connected with concatenation operator echo "PHP: " , "the best language", " ever"; // connected with multiple parameters // javascript echo "";

Run Example ››

echo can output variables.

PHP Echo Example - Output Variables


";

$x = 5;
$y = 10;
echo $x + $y; // outputs 15

echo "
"; $link = 'https://developer.hyvor.com'; echo "Hyvor Developer";

Run Example ››

Any statement in PHP can be used with or without parentheses as following.

  • echo or echo()

PHP Echo with Parentheses


Run Example ››