Hey I've been reviewing over w3schools and I just want to check if my naming of syntax is right
if someone can check it or help me out
<?php
if (isset($_POST['name']) && isset($_POST['name2'])) {
$num=$_POST['name'];
$num2=$_POST['name2'];
echo $num . ' multiplyed by '. $num2 . ' = '.$num*$num2;
}
else{
echo '';
}
?>
the if
is a condition statement?
isset
is function
$_POST[name]
is inside the parameter and it is a global variable (question what exactly is the definition of a global variable)
$num
and $num2
are variables
name
and name2
are marks from the HTML name, but what is the correct definition of name
and name2
no. - if
in PHP it is called a construct. But many would argue it okay to call a conditional statement. A conditional statement is really the statement inside the if block. As you can see we actully have multiple statements.
if(condition) { // <- This is a if statement.
statement // the statement is conditional.
yes - isset
is a native php function
yes - $num and $num2
are variables. (if you do not know all types a variable can be in PHP, now would be a great time to learn.)
Lastly "name and name2 are marks from the HTML name, but what is the correct definition of name and name2" no - are called keys, array index or subscript. These provide a way to define which specific index in a array we are using.
$_POST is a native superglobal variable of the type array. A superglobal is accessable from all scopes. If you have not yet encountered what scopes are, no worries, you will as soon.