1. What can PHP do?
What can PHP do? I think it is very powerful. It can do anything I can think of, but my technical skills are not good enough╮(╯﹏╰)╭. Okay, let’s have a basic understanding with a picture (ps: PHP’s functions are not limited to this (^_^))
The image is a bit blurry, try to make it better, (≧▽≦)/
2. PHP language tags
1. End and start tags
1.1 : It belongs to xml style and is the standard style of PHP. It is recommended to use.
1.2 : Long style tag, not commonly used. If your weird editor doesn’t support other php tags, use this
1.3 //code ?>: Short style, follow SGML processing. You need to turn on the short_open_tag directive in php.ini, or add –enable-short-tags when compiling PHP. If you want your program to be more portable, abandon this style. It will have one less PHP than 1.1.
2. Location
How to say it? Anyway, you can put the PHP language anywhere in the HTML file with the suffix .php. Note that it is an HTML file ending with .php.
What to do if the condition is true
3.2 Multi-line comments cannot be nested, but they can contain single-line comments; single-line comments can also contain multi-line comments. This is what I want
Copy code1. Use of variables
Copy code
4. Constants
1. Definition and usage
2.1 The scope of constants is global, and constants can be declared and accessed anywhere in the script.
2.2 Constants do not have $ in front of them, and constants cannot be defined through assignment statements.
2.3 Once a constant is defined, it cannot be redefined or undefined until it is automatically released after the script runs.
2.4 The value of a constant can only be a scalar (a type of boolean, integer, float, string)
3. System predefined constants
4. Commonly used magic constants
Double quotes are used to output strings. For example: echo "Data insertion failed, error message:
";
And "INSERT INTO testtable VALUES('".$xm."',".$nl.")"; in INSERT INTO testtable VALUES It is a string, which means inserting into the database. The two "" are a group, which separates .$xm.. $xm in (.$xm.) is a variable. Echo is used when displaying a variable in PHP.
"PHP and MySQL Web Development" is the "php bible". In comparison, "Learning PHP from Zero Basics" is more suitable for beginners. Reading this book, it is easy to feel that the author wrote it carefully.
This book is actually one of the series "Learning Programming from Zero Basics", the others are very good.
The content is well designed. There is a preface that is very pertinent. It is advice given by experienced programmers to newbies. Here is the excerpt:
++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++
Things to note when learning programming A few points:
1. Don’t memorize grammar: Many beginners try to memorize various grammars. In fact, this is extremely wrong. There are so many grammars and specifications in program development that it is impossible to remember them all. You only need to know that there are Such a function is enough. You can browse books or find help files when needed, which saves time and effort.
2. Use multiple hands and practice more: People who only know how to chew books will not become masters of development. Only by writing programs on the computer more can you improve your understanding of programming in practice.
3. When you encounter a problem, try to solve it yourself first: use your own time to try your best to solve it. If it doesn’t work, go to someone for help. Never ask someone for help immediately when you encounter a problem. This will never improve much. .
4. Use Google and Baidu more: The Internet is a large knowledge base and the best teacher. The problems you encounter have been encountered by others, so search more.
4. Read more other people’s source codes: Understand other people’s design ideas and constantly integrate them into your own use.
++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++
The shortcoming of this book is that there are no line markings in front of the code, and "at line xxx," is used extensively in the explanation of the code, A big mistake.
Summary: In terms of knowledge points, "Learning PHP from Zero Basics" may not be complete, but what we need is not a dictionary, what we need is a step-by-step book that will make you interested in learning, right? ?