How to end a variable name in string without space
Wrap the name of the variable with braces.
$num = 1;
echo "${num}st";
Or use printf
syntax instead of simple interpolation:
$num = 1;
printf("%dst", $num);
Wrap the name of the variable with braces.
$num = 1;
echo "${num}st";
Or use printf
syntax instead of simple interpolation:
$num = 1;
printf("%dst", $num);