当前位置:网站首页>PHP base notes - NO. 1
PHP base notes - NO. 1
2022-08-03 18:09:00 【WDm-xmax】
Original ID: GUIDM
I was so busy in July that I didn't have time to update, and I didn't read all the private messages sent by everyone on CSDN, so I'm very sorry everyone.
Recently learning PHP, JavaScript advanced version is temporarily suspended.After learning PHP to update the front-end content.
The PHP column is purely a study note recorder.thanks for your support.
Table of Contents
1. Basic introduction
- PHP: (Hypertext Preprocessor), a widely used open source general server scripting language, suitable for web development and embedded in HTML.
- A programming language that does not require compilation and is directly executed by an interpreter/virtual machine
- PHP program execution flow:
2. PHP program
- Default extension: .php
- The php file can contain: html, css, JavaScript code.
Several tags:
1. ASP tags:
<% PHP code %>
2. Short tag:
3. Script tags:
4. Standard markup:
- Common tags are: standard tags.
- ASP and short tags are basically deprecated, if you want to use them, you need to open them in the configuration file
PHP syntax:
- ";" indicates the end of the statement.
- {} indicates the end of a statement.
- The closing tag of a PHP block also automatically indicates a semicolon (so there is no need to use a semicolon on the last line of a PHP block)
Notes
- (#)//Single line comment
- /* */Multi-line comment
/**@author:*@Function:*/
Habit: All code must be commented while writing.
The firstAn output function
- The
- echo() function outputs one or more strings.
3. PHP variables
Variable definition: Add the corresponding variable name (memory) in the system.
- Variable declaration: $variable name.
Assignment: You can assign data to a variable (this can be done at the same time as the definition).
Variable Naming Rules
Numbers cannot be used at the beginning of
- .
- There must be no spaces in between.
- Three nomenclatures:
Underline nomenclature: Link 2 English words with underscores.Such as: one_two Small camel case: capitalize the first letter of the second word such as: newFile CamelCase: Capitalize the first letter of all words eg: NewFile
The mixing of html and PHP needs to be under the PHP file.
With the same variable name together, the next sentence will cover the above sentence.
Variables
If the value stored by a variable happens to be the name of another variable, then you can get the value of another variable directly by accessing a variable: add an extra $ sign before the variable.
Process:
- Find $a, interpret the result as "b";
- Bind the preceding $ sign to the result b;
- The result of the analysis is bb;
value by variable
Assign one variable to another.
- Value transfer: copy the value saved by the variable, and save the new value to another variable (the two variables are not related).$a=$b
- Pass by reference: Pass the memory address where the value stored by the variable is located to another variable.Two variables point to the same memory space (two variables are the same value.) $new variable=&$old variable
//Value transfer:// pass by reference
Several partitions of memory:
Stack area, code segment, data segment, heap area.
边栏推荐
猜你喜欢
随机推荐
Crack:WebKitX ActiveX and WebKitX VHX
目标检测-YOLOv3理论讲解
ImportError: /lib/libgdal.so.26: undefined symbol: sqlite3_column_table_name
Mock模拟数据,并发起get,post请求(保姆级教程,一定能成功)
【mysql】SIGN(x) function
云图说丨初识华为云微服务引擎CSE
CodeTON Round 2 (Div. 1 + Div. 2, Rated, Prizes!) A-E
理想L9旗舰级的安全性有多强?守护一家人安全出行“底线”
云图说丨初识华为云微服务引擎CSE
LyScript 内存交换与差异对比
STM32——LCD—FSMC原理简介
云GPU如何安装和启动VNC远程桌面服务?
这是Facebook母公司 关于元宇宙的80万亿美元豪赌
调用EasyCVR云台控制接口时,因网络延迟导致云台操作异常该如何解决?
揭秘deepin 23,从这里开始!
yaml data format
@resource和@autowired的区别
MVCC多版本并发控制的理解
cell delay and net delay
七夕