Course Content

  • PHP Variables

Course Content


A variable in PHP is a name of memory location that holds data. In PHP, a variable is declared using $ sign followed by variable name. The main way to store information in the middle of a PHP program is by using a variable. Here are the most important things to know about variables in PHP.

Variables are containers that store data. PHP is a programming language that is used to create web pages with dynamic content. Variables are containers with data in them, which you can use for different purposes, like storing the name of the user who is browsing your website or how many times someone has viewed your website. Variables in PHP work similarly to variables in most other programming languages. There are two types of variables in PHP - scalar and array. Scalar is simply a container that stores one value at a time, while arrays can store multiple values at the same time.

A local variable is one that is declared inside a function and only accessible from within that function. A global variable, on the other hand, can be accessed from anywhere in your program.Variables are nothing but memory locations that store data. They store data as different values or as a string of text. The scope of variable defines the range where the variable is valid and usable. Global variables can be accessed throughout your program, whereas local variables can only be accessed within their own function.

Recommended Courses

Share With Friend

Have a friend to whom you would want to share this course?

Download LearnVern App

App Preview Image
App QR Code Image
Code Scan or Download the app
Google Play Store
297K+ Downloads
App Download Section Circle 1
4.5 Rating
App Download Section Circle 2
10K+ Reviews
App Download Section Circle 3
  • Learn anywhere on the go
  • Get regular updates about your enrolled or new courses
  • Share content with your friends
  • Evaluate your progress through practice tests
  • No internet connection needed
  • Enroll for the webinar and join at the time of the webinar from anywhere