Output Rentetan dengan Sisipan dalam PHP

printfsprintf
Задание 1

Diberi pembolehubah:

php<?php
  $price = 19.99;
?>

Outputkan harga dalam format berikut:

php'price: 19.99
Задание 2

Diberi pembolehubah:

php<?php
  $name = "John";
  $age = 25;
?>

Outputkan rentetan dalam format berikut:

php'Name: John, Age: 25 years'
Задание 3

Diberi pembolehubah:

php<?php
  $name = 'John';
  $score = 95;
?>

Outputkan rentetan berikut:

php'student John scored 95 points'
Задание 4

Diberi pembolehubah:

php<?php
  $product = "Laptop";
  $price = 1299.99;
  $discount = 15;
?>

Outputkan maklumat produk dalam format:

php'Product: Laptop | Price: $1299.99 | Discount: 15%'
Задание 5

Diberi pembolehubah:

php<?php
  $x = 10;
  $y = 20;
  $z = 30;
?>

Outputkan hasil dalam format:

php'Sum: 10 + 20 + 30 = 60'
Задание 6

Diberi pembolehubah:

php<?php
  $day = 15;
  $month = "March";
  $year = 2023;
?>

Outputkan tarikh dalam format:

php'Date: March 15, 2023'