Utskrift av sträng med insättning i PHP
printfsprintfЗадание 1
Given variabel:
php<?php
$price = 19.99;
?>
Skriv ut priset i följande format:
php'price: 19.99
Задание 2
Givna variabler:
php<?php
$name = "John";
$age = 25;
?>
Skriv ut strängen i följande format:
php'Name: John, Age: 25 years'
Задание 3
Givna variabler:
php<?php
$name = 'John';
$score = 95;
?>
Skriv ut följande sträng:
php'student John scored 95 points'
Задание 4
Givna variabler:
php<?php
$product = "Laptop";
$price = 1299.99;
$discount = 15;
?>
Skriv ut produktinformation i formatet:
php'Product: Laptop | Price: $1299.99 | Discount: 15%'
Задание 5
Givna variabler:
php<?php
$x = 10;
$y = 20;
$z = 30;
?>
Skriv ut resultatet i formatet:
php'Sum: 10 + 20 + 30 = 60'
Задание 6
Givna variabler:
php<?php
$day = 15;
$month = "March";
$year = 2023;
?>
Skriv ut datumet i formatet:
php'Date: March 15, 2023'