Home >Backend Development >PHP Tutorial >PHP basic tutorial notes

PHP basic tutorial notes

WBOY
WBOYOriginal
2016-08-08 09:19:171054browse

I have known PHP for a long time, but I have never had time to learn it. Now I have to learn PHP hard. I hope that one day I will be freed from the cumbersomeness of C# and move towards the simplicity and clarity of PHP. The huge development environment alone is enough trouble for me. I have to install vs and sql every time I install it.

The PHP environment is very simple to set up, because I took a shortcut and downloaded wamp5 online, which is windows+apache+mysql+php. After the installation was completed, php, apache, and mysql were all installed. I accidentally made a mistake, 64-bit The corresponding 64-bit version of window must be installed, otherwise strange errors will occur!

Of course you need books to learn a language. I found an electronic version of PHP Basic Tutorial 4 on the Internet, which is very suitable for PHP novices to learn. The following are my study notes. Record them for future reference. It is also a reminder for myself.

1. hello world

Several ways to output hello world

print "hello world!";

print_r("hello world!");

eval("echo "hello world";")
?>

Note: echo can output multiple values ​​at one time, separated by commas. echo is a language construct, not a real function, so it cannot be used as part of an expression.
print() function print() prints a value (its parameter) and returns true if the string is successfully displayed, otherwise it returns false.
print_r() can simply print out strings and numbers, while arrays are displayed as a bracketed list of keys and values, starting with Array. But the results of print_r() outputting Boolean values ​​and NULL are meaningless, because they all print "n". Therefore, using the var_dump() function is more suitable for debugging. The

eval() function will execute the php code in the string.

The above has introduced the notes of the basic PHP tutorial, including various aspects. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn