Answers for "template string php"

PHP
0

template string php

You could also use strtr:

$template = '$who likes $what';

$vars = array(
  '$who' => 'tim',
  '$what' => 'kung pao',
);

echo strtr($template, $vars);
Outputs:

tim likes kung pao
Posted by: Guest on March-05-2021

Browse Popular Code Answers by Language