You can concatenate the HTML strings and the string returned by the function.
Code: Select all
<?php echo '<td width="25%">' . number_format($result['price'], 2, '.', ',') . '</td>'; ?>
You can output the HTML directly (drop out of PHP mode) and enter PHP mode to echo the result of the function.
Code: Select all
<td width="25%"><?php echo number_format($result['price'], 2, '.', ','); ?></td>
You can store the result of the function in a variable and embed the variable in a string.
Code: Select all
<?php
$price = number_format($result['price'], 2, '.', ',');
echo "<td width=\"25%\">$price</td>";
You can pass the returned value to printf() or sprintf().
Code: Select all
<?php printf('<td width="25%%">%s</td>', number_format($result['price'], 2, '.', ',')); ?>
You can't, however, call a function from within a string.
Edit: This post was recovered from search engine cache.