Uitvoer van string met invoeging in PHP
printfsprintfЗадание 1
Gegeven variabele:
php<?php
$price = 19.99;
?>
Geef de prijs weer in het volgende formaat:
php'price: 19.99
Задание 2
Gegeven variabelen:
php<?php
$name = "John";
$age = 25;
?>
Geef de string weer in het volgende formaat:
php'Name: John, Age: 25 years'
Задание 3
Gegeven variabelen:
php<?php
$name = 'John';
$score = 95;
?>
Geef de volgende string weer:
php'student John scored 95 points'
Задание 4
Gegeven variabelen:
php<?php
$product = "Laptop";
$price = 1299.99;
$discount = 15;
?>
Geef de productinformatie weer in het formaat:
php'Product: Laptop | Price: $1299.99 | Discount: 15%'
Задание 5
Gegeven variabelen:
php<?php
$x = 10;
$y = 20;
$z = 30;
?>
Geef het resultaat weer in het formaat:
php'Sum: 10 + 20 + 30 = 60'
Задание 6
Gegeven variabelen:
php<?php
$day = 15;
$month = "March";
$year = 2023;
?>
Geef de datum weer in het formaat:
php'Date: March 15, 2023'