Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the variable in php

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article introduces the relevant knowledge of "what are variables in php". In the operation of actual cases, many people will encounter such a dilemma. Then let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

Variables in php are "containers" for storing information, and similar to algebra, PHP variables can be assigned a value (xchang5) or an expression (z=x+y); variables can be short names (such as x and y) or more descriptive names (such as age, carname, totalvolume).

Operating environment of this tutorial: windows7 system, PHP7.1 version, DELL G3 computer

What does a variable mean in php?

Variables in php are containers for storing information.

Similar to algebra, a PHP variable can be assigned a value (XForm5) or an expression (z=x+y).

Variables can be short names, such as x and y, or more descriptive names, such as age, carname, totalvolume.

PHP variable rules:

The variable begins with the $symbol, followed by the name of the variable

Variable names must start with a letter or an underscore character

Variable names can only contain letters, numbers, and underscores (Amurz, 0-9, and _)

Variable names cannot contain spaces

Variable names are case-sensitive ($y and $Y are two different variables)

Both lamp PHP statements and PHP variables are case-sensitive.

Create (declare) PHP variable

PHP does not have a command to declare variables.

The variable is created the first time you assign it:

Example

In the above statement execution, the variable txt will hold the value Hello worldview, and the variable x will hold the value 5.

Note: when you assign a text value to a variable, put quotation marks around the text value.

That's all for "what are variables in php?" Thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report