0

<?php echo $_POST["name"] ; ?> Why we need Square Bracket here ?

i wanna know why this syntax is used?

16th Apr 2017, 10:59 PM
Helal Chowdhury
Helal Chowdhury - avatar
5 Antworten
+ 13
Every array needs subscript as a square brackets [ ] to show the value at particular index. Since $_POST is an array, it needs square brackets.
17th Apr 2017, 2:48 AM
Sachin Artani
Sachin Artani - avatar
+ 11
In form handling where you have to store values of name, email, mobile number, age, gender, passwords, about, photo etc. All those values are held by a single array, which is either $_GET or $_POST
17th Apr 2017, 4:54 AM
Sachin Artani
Sachin Artani - avatar
+ 8
Cuz internally $_POST is an array which stores all values u want to pass using post
16th Apr 2017, 10:39 PM
Shraddha
Shraddha - avatar
+ 1
$_POST is an associative array. As per the language design, accessing elements of such an array is performed via the square bracket notation: echo $_POST["key"];
16th Apr 2017, 10:50 PM
Helal Chowdhury
Helal Chowdhury - avatar
0
why $_POST is an array?
17th Apr 2017, 4:00 AM
Helal Chowdhury
Helal Chowdhury - avatar