PHP 7 |HINDI | Variables(Global scope)

Опубликовано: 20 Май 2026
на канале: mishra sr IT WALE
5
2

PHP Variables

Variables are "containers" for storing information.
Creating (Declaring) PHP Variables

After the execution of the statements above, the variable $txt will hold the value Hello world!, the variable $x will hold the value 5, and the variable $y will hold the value 10.5.

Note: When you assign a text value to a variable, put quotes around the value.

Note: Unlike other programming languages, PHP has no command for declaring a variable. It is created the moment you first assign a value to it.

Think of variables as containers for storing data.
PHP Variables

A variable can have a short name (like x and y) or a more descriptive name (age, carname, total_volume).

Rules for PHP variables:

A variable starts with the $ sign, followed by the name of the variable
A variable name must start with a letter or the underscore character
A variable name cannot start with a number
A variable name can only contain alpha-numeric characters and underscores (A-z, 0-9, and _ )
Variable names are case-sensitive ($age and $AGE are two different variables)

Remember that PHP variable names are case-sensitive!

__________________________PHP Variables Scope

In PHP, variables can be declared anywhere in the script.

The scope of a variable is the part of the script where the variable can be referenced/used.

PHP has three different variable scopes:

local
global
static

Global and Local Scope

A variable declared outside a function has a GLOBAL SCOPE and can only be accessed outside a function

If you found this video valuable, give it a like.
If you know someone who needs to see it, share it.
If you have questions ask below in comment section.
Add it to a playlist if you want to watch it later.
________________________________________________

T A L K W I T H M E !
Email: [email protected]
ALSO I GIVE U "ANYDESK SUPPORT"
________________________ _______________________

Make sure you LIKE, SUBSCRIBE, COMMENT, and REQUEST A VIDEO! :)
_________________________________