Hi! Could we please enable some services and cookies to improve your experience and our website?
Online Sandbox for SQL and PHP: Write, Run, Test, and Share SQL Queries and PHP Code
<?php
echo "Current Date and Time: " . date("Y-m-d H:i:s");
?>
<?php
// Step 1: Create associative array
$student = array(
"name" => "Charmi",
"age" => 18,
"grade" => "A"
);
// Step 2: Print only the name
echo "Student Name: " . $student["name"] . "<br>";
// Step 3: Add a new key-value pair
$student["subject"] = "Math";
// Step 4: Print the updated array
echo "<pre>";
print_r($student);
echo "</pre>";
?>