PHP Superglobals
PHP Superglobals are built-in variables that are always accessible, regardless of scope. Common ones include $_GET
, $_POST
, $_SERVER
, $_SESSION
, and $_COOKIE
.
PHP Superglobals ऐसे built-in variables हैं जो हर जगह से उपलब्ध होते हैं। जैसे $_GET
, $_POST
, $_SERVER
, $_SESSION
, और $_COOKIE
।
Example: $_SERVER
$_SERVER
contains information about headers, paths, and script locations.
$_SERVER
में headers, paths, और script के location की जानकारी होती है।
<?php
echo $_SERVER['SERVER_NAME'];
?>
localhost
Example: $_GET
$_GET
collects data sent in the URL.
$_GET
URL से भेजे गए data को प्राप्त करता है।
<?php
// URL: example.com/index.php?name=John
echo $_GET['name'];
?>
John