PHP Superglobals Variable in Hindi – Superglobals in Hindi:- Superglobals Variables Ko Ham Kahi Se Bhi Access Kar Sakte Hain Or Ye PHP Main Built-in Variables Hote Hain And Ye Function Ke Under Or Bahar Dono Se Ham Kahi Bhi Or Kabhi Access Kar Sakte Hain |
PHP Superglobals Variable in Hindi
Contents
PHP Main Superglobals Variables Koi Types Ke Hote Hain Or Unhe Ham Ek Ek Karke Understand Karte Hain With Examples |
- $GLOBALS
- $_SERVER
- $_REQUEST
- $_POST
- $_GET
- $_FILES
- $_ENV
- $_COOKIE
- $_SESSION
$GLOBALS Variables in PHP in Hindi
Global Variables, Function Ke bahar Hote hai | Unki visibility function Ke under or bahar Hoti Hain. Unka scope pure program par Hota hai |
PHP Main Variable Ko global Banane Ke Liye $GLOBALS Keyword Ka Istemal Kiya Jata Hain|
For Example:
<?php $x = 5; function myTest() { echo $GLOBALS['x']; } myTest(); ?>
Output:
5
Aap Dekh Sakte Hain Hamne Local $x Variable ko $GLOBALS[‘x’] Ki Help Se Acces Kiya Hain And Bina $GLOBALS Ke Help Se Undefined Error Show Hoga |
$_SERVER Variables in PHP in Hindi
$_SERVER Ka Istemal Karke Ham HTTP Connection , SERVER Information , HOST Information , URL Information Ki Sari Jankari Le Sakte Hain |
$_SERVER Ka Isliye Bhi Istemal Karte Hain Ki Ek Page Main Jaise file.php File Main Form Ko Submit Karne Ke Bad Usi Page file.php Main Database Main Data Ko Store Karna And Print Karna Or Kaise Isi Page Main Conditional Page Content Dikha Sakte Hain |
Example:
<?php echo $_SERVER['PHP_SELF']; echo "<br>"; echo $_SERVER['SERVER_NAME']; echo "<br>"; echo $_SERVER['HTTP_HOST']; echo "<br>"; echo $_SERVER['HTTP_USER_AGENT']; echo "<br>"; echo $_SERVER['SCRIPT_NAME']; ?>
Output:
/index.php 127.0.0.1 127.0.0.1:8000 Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36 /index.php
Aap Dekh Sakte Hain Ki Hamne $_SERVER Ki Help Se Server Ki Information Print Kara Li Hain |
$_REQUEST Variables in PHP in Hindi
PHP $_REQUEST Ka Istemal Ham Form Main Submit Button Par Click Karne Ke Bad Data Ko Collect Karne Mai Karte Hain |
Example:
<!DOCTYPE html> <html> <head> <title>PHP Data Form</title> </head> <body> <form method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>"> Name :<input type="text" name="fname" placeholder="Enter Your Name :"> <input type="submit"> </form> <?php if($_SERVER['REQUEST_METHOD']== 'POST'){ $name = $_REQUEST['fname']; echo $name; } ?> </body> </html>
Output:

Aap Dekh Sakte Hain Ki Maine Request Ki Help Se Data Ko fatch Kiya Hain Or Phir Use $_SERVER[‘PHP_SELF’] Ki Help Usi Page Main Print Karaya Hain.
$_POST Variables in PHP in Hindi
PHP $_POST Ek Global Variable Hai Or Iska Istemal Ham Form Ke Data Ko Submit Button Par Karne Click Karne Ke Bad And method=” post” Hone Par Data Ko Backend Main Store Karte Hain Or method=’post’ Hone Par Url Main Data Show Nhi Hota Hain |
Example:
<!DOCTYPE html> <html> <head> <title>PHP Data Form</title> </head> <body> <form method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>"> Name :<input type="text" name="fname" placeholder="Enter Your Name :"> <input type="submit"> </form> <?php if ($_SERVER['REQUEST_METHOD'] == 'POST'){ $name = $_REQUEST['fname']; echo $name; } ?> </body> </html>
Output:

$_GET Variables in PHP in Hindi
PHP $_GET Ek Global Variable Hai Or Iska Istemal Ham Form Ke Data Ko Submit Button Par Karne Click Karne Ke Bad And method=”get” Hone Par Data Ko Backend Main Store Karte Hain Or method=’get’ Hone Par Url Main Data Show Hota Hain.
Yanki ki get Method Data URL ko Bhi Sent Karta Hain |
Example:
<!DOCTYPE html> <html> <head> <title>PHP Data Form</title> </head> <body> <form method="get" action="<?php echo $_SERVER['PHP_SELF'] ?>"> Name :<input type="text" name="fname" placeholder="Enter Your Name :"> <input type="submit"> </form> </body> </html>
Output:

Aap Dekh Sakte Hain Submit Button Par Click Karne Ke Bad get method Ne Url Ko Data Sent Kar Diya Hain |
Friends Baki Function Ko Aage Ki Post Mai Dekhne Wale Hain |