PHP: String

↑ top




string interpolation


without printf

$variable = "World";
$output = `Hello ${variable}!`;
echo $output

# Hello World


using printf

$variable = "World";
$template = "Hello %s!";
$output = printf(template, $variable);
echo $output

# Hello World


↑ top