Utskrift av streng med innsetting i PHP
Gitt en variabel:
<?php
$price = 19.99;
?>
Skriv ut prisen i følgende format:
'price: 19.99
Gitte variabler:
<?php
$name = "John";
$age = 25;
?>
Skriv ut strengen i følgende format:
'Name: John, Age: 25 years'
Gitte variabler:
<?php
$name = 'John';
$score = 95;
?>
Skriv ut følgende streng:
'student John scored 95 points'
Gitte variabler:
<?php
$product = "Laptop";
$price = 1299.99;
$discount = 15;
?>
Skriv ut produktinformasjon i formatet:
'Product: Laptop | Price: $1299.99 | Discount: 15%'
Gitte variabler:
<?php
$x = 10;
$y = 20;
$z = 30;
?>
Skriv ut resultatet i formatet:
'Sum: 10 + 20 + 30 = 60'
Gitte variabler:
<?php
$day = 15;
$month = "March";
$year = 2023;
?>
Skriv ut datoen i formatet:
'Date: March 15, 2023'