Exemple #1
0
foreach ($stocks as $stock) {
    ?>
                <tr>
                    <td><?php 
    echo $stock["symbol"];
    ?>
</td>
                    <td><?php 
    echo $stock["name"];
    ?>
</td>
                    <td><?php 
    echo $stock["shares"];
    ?>
</td>
                    <td><?php 
    echo trim_zeroes($stock["price"]);
    ?>
</td>
                    <td><?php 
    echo trim_zeroes($stock["price"] * $stock["shares"]);
    ?>
</td>
                </tr>
            <?php 
}
?>
        </tbody>
    </table>
</div>
Exemple #2
0
</form>

<?php 
if (isset($stock)) {
    ?>
    <div class="alert alert-success" role="alert">
        <strong><?php 
    echo htmlspecialchars($stock["symbol"]);
    ?>
</strong> 
        <?php 
    echo htmlspecialchars($stock["name"]);
    ?>
 
        <?php 
    echo trim_zeroes($stock["price"]);
    ?>
    </div>
<?php 
}
?>

<?php 
if (isset($error)) {
    ?>
    <div class="alert alert-danger" role="alert"><?php 
    echo htmlspecialchars($error);
    ?>
</div>
<?php 
}