proměnné php
<?php
/* In PHP, a variable starts with the $ sign,
followed by the name of the variable:
*/
$txt = "Hello world!";
$x = 5;
$y = 10.5;
?>
proměnná php v řetězci
$a = '12345';
// This works:
echo "qwe{$a}rty"; // qwe12345rty, using braces
echo "qwe" . $a . "rty"; // qwe12345rty, concatenation used
// Does not work:
echo 'qwe{$a}rty'; // qwe{$a}rty, single quotes are not parsed
echo "qwe$arty"; // qwe, because $a became $arty, which is undefined
jak vytvořit proměnnou v php
$varName = "Hello, World";
Proměnná PHP v řetězci
phpCopy# php 7.*
<?php
$txt = "salt";
echo "{$txt}y";
?>