Term category

(1) $myVar=123;

(2) $_SESSION['mySession']=345;

(3) $_POST['myPost']

(4) $_GET['myGET']

(5) echo 

(6) exit()

I like to call:

Are the definitions above all correct?

No. Rather than tell you what is what how about you read the manual and then tell us what is wrong.

1 Like

Without spoiling the surprise further, (1) and (2) contain more than one “thing” to be termed.

  1. True.
  2. Depends.
  3. True, but incomplete.
  4. True.
  5. True
  6. True
  7. False
  8. False
1 Like

It means $var below is sometimes a local variable. but other time it is not a local variable.

$var=123;

Would you give me an example which is not a local variable, please?

<?php
$a = 3;

function dosomething() {
  $b = 2;
}
?>

$a is a global variable. $b is a local variable.

See the Manual Entry for Variable Scope.

I mistook a global variable for a variable passing over to a next page.

Then how do you call a variable which is passing over to a next page, for example session variable, post variable, and get variable as a whole?

Well, you’ve given two different things the same definition.

Get and Post variables are not PHP variables ‘passed over’ between pages. They are form data or URL data that are sent by the browser, not PHP.

Session variables are the only thing that PHP actually retains between page loads.

Is the quote below correct or wrong?

I could be wrong and it would not be the first time :slight_smile:

Sessions apply to all pages whereas Cookies apply to a single page.

I like to call sessions are pages variables and cookies are page variables.
Does it make sense in your English sense?

if it makes sense, then post variables and get variables will be also pages variables because they do passing over to another page.

Cookie variables, like Get and Post variables, are not retained by PHP. They are sent by the browser with each page request; it is the Browser that maintains the cookie, and sends its cookie data every time it requests the page (until the cookie expires.)

Is the quote below correct?

No. They are HTTP Request Variables AKA Super Globals

https://www.php.net/manual/en/language.variables.superglobals.php

https://www.php.net/manual/en/reserved.variables.request.php

HTTP Request Variables are, I think, good term for them.
Thank you, benanamen.

I do commend you on your effort to get these things right. It is important that you “Speak the same Language” in this field.

There have been several times on the forums where newbies (or is it “Persons of lesser experience” for the PC culture?) refer to something in a way other than it is commonly known and it causes great confusion and wasted time until it is figured out what they are actually talking about.

1 Like

I feel some difficulty, I guess that it is because I don’t speak the same lanuage with you and other mentor.

In order to speak same language, I need to read the manual, again, again and again although reading manual is challenging to me as a non-native speaker of English.
I hope I speak the same language with you.
Thank you for your comment.

Are the quote above all correct?