Home  >  Article  >  Backend Development  >  [100 days of lighting up PHP] Day 1: Another look at PHP, basic syntax_PHP tutorial

[100 days of lighting up PHP] Day 1: Another look at PHP, basic syntax_PHP tutorial

WBOY
WBOYOriginal
2016-07-14 10:09:501011browse

Written purely by the author himself. It aims to lead everyone to use optimistic and happy experiences to learn a skill that can make a living. Note: There is no better or worse among php, java, python, etc. The most important thing depends on which language you learn can help you make more money. Because generating profits and gaining a sense of accomplishment is the way to go.

Suitable for everyone
Comrades who have installed and configured php. If not, it is recommended to search for it on Baidu. This series does not cover initial installation and configuration.
Second-generation rich, second-generation officials, programmers with the ability, luck and network resources like Kai-Fu Lee, Jack Ma, and Ma Huateng, please close this page directly. This article may have wasted your precious time
Why should I write about php?
Dear, when you want to start a business or do some additional projects. php is your best helper because:
1. When you have insufficient resources, the small customers you find will not spend money to buy oracle or .net or java servers.
2. When you are short of funds, you are not willing to recruit some java employees.
3. When you talk about Python with early-stage small customers, most small customers will not agree with you, but PHP is different. Let’s introduce Taobao.
4. If you are working on the Internet (when you are just starting out), php is your best choice in the early stage.
5. Programmers who have had real entrepreneurial experience know that when you spend your energy developing an Iphone or other awesome products without any income. Letting your team use PHP to build some websites or OA is the best way to survive for a period of time.
php comments:
PHP is easy to use but difficult to control. Just like a boy or a girl who is very easy to catch up with, there may be big problems in the future. Either he (she) knocks you, or you knock everyone else. Therefore, when learning a language, you must learn to control it, ride it like a horse, rather than letting the horse ride you.
Regarding what is wrong with this article
This is normal, no need to make a fuss at all. There are times when the constitution needs to be revised.
The following is the text part:
(1) About page suffix
Since you write PHP, the page suffix is ​​always *.php. No reason, because our time is too precious. Don't always worry about URL rewriting, Du Niang is very smart now. Whether it is a website or software, if the content is good, she will definitely include it. No matter how friendly your URL is, today’s netizens won’t be able to remember it. I have a friend who makes a lot of money every day on Taobao. He doesn't even use the second-level domain name that comes with Taobao. That's because repeat customers only include your URLs. I can type out no more than 5 URLs by hand.
(2) About mark
When you use it means you are writing a php program. Don't go online to look up how to omit the php keyword behind
You can insert countless such code tags into the page, you can do whatever you like. (In fact, standard PHP projects all use templates + program analysis. I would like to add that novices should not struggle with this sentence, you will naturally learn it later)
(3) About $
PHP sets a variable starting with $, such as: $str='I don't like the United States'; This defines a variable named str, and I temporarily set its value to 'I don't like the United States'. Because maybe I suddenly feel that the United States is okay later, so I will set the value to 'I don't like Japan'. So this is called a "variable". Men are also fickle, please understand me.
(4) About + and.
1+1=?, everyone knows that it is 2. So in php $a=1+1; this $a is naturally 2. But the string addition uses '.', $a='1'.'1'; this $a is '11'. And it is also a string type. There is no reason, the founder of PHP loves this, you can do anything to him.
(5) About echo
PHP’s iconic syntax. echo "I don't like Japan";. You can immediately output this sentence that many people recognize on the page. If you don’t believe me, try it. Of course, I don’t mind if you change Japan to the name of some country.
(6) About single quotes and double quotes
Strings can be summarized in double quotes or single quotes. I like to use single quotes because you don't have to press the shift key to type them. Hope you like it too. Try not to use too many double quotes. One is to protect the left shift key from premature blurring. On the other hand, the $ variable inside the double quotes will be interpreted. I heard a great guy say that programs written by macho men never use double quotes. I looked in the mirror and thought I was okay.
That’s it. After learning the above grammar, it is definitely enough to learn so much on the first day. Next, tell a story.
The first time my roommate and I went to a company for an interview, because it was the first interview with my roommate and she was very scared and nervous. When I woke up in the morning and brushed my teeth, my roommate’s toothbrush brushed the wrong parts of his face several times in a row. I showed mercy and said I would go with you. So, I became the "cousin" of the roommate and went together.
The interviewer probably didn’t have breakfast and came here with messy hair. The two of us had already taken the lead in sitting in the interview conference room.
My roommate’s hand was shaking, and I noticed it from the corner of my eye, so I pressed his hand. The interviewer looked at me strangely. I pulled my hand back in horror.
After the interviewer knew that I was just a "cousin", he started asking questions about my roommate.
"How are you doing with PHP?". The interviewer's first question, I think this question is really difficult to answer.
"It's okay..." The roommate was extremely nervous.
The interviewer turns on his computer and asks his roommate to type "this is my world.it’s my test".
My roommates can still hold on at critical moments. Quickly hit the echo 'this is my world
it‘s my test‘;
"Great, can you change the way you write code?" The interviewer began to "tease" the roommate.
As a "cousin", I am also very anxious. I'm afraid that my roommate will be nervous. In fact, my roommate usually studies well, but when he gets nervous, his mind goes blank.
My roommate looked at me, and I responded with a "you can do it" look. My roommate told me with his eyes that he would work hard.
So the roommate played next. echo 'this is my world'.'
'.'it‘s my test';
"Write a few more!" The interviewer's expression was close to "obscene". At that time, I wanted to "descend" him as a "cousin".
Roommate, I really want to write it on behalf of my roommate. But do you think it’s possible?
At the critical moment, the interviewer’s phone rang. I personally guessed it was the interviewer’s wife’s phone number. The interviewer answered the phone with a pious expression. A soprano voice came from the other end of the phone, and the interviewer ran out in embarrassment.
During this gap, I quickly asked my roommate to give way. So I wrote down the sentence that finally allowed my roommate to pass the first round of interview.
1. echo 'this is my world','
','it‘s my test';
2. $string_1='this is my world';
$string_2='it‘s my test';
$sign='
';
$result=$string_1.$sign.$string_2;
3. $arr=array('this is my world','
','it‘s my test');
echo implode($arr);
Finish writing quickly and the interviewer will reply. After being chastened by the soprano, the interviewer's expression became noticeably gentler. I lowered my head and played with my phone, looking innocent.
The roommate’s hand left the keyboard just in time.
The interviewer seemed very satisfied and started to ask a few common questions. For example: Do you have a girlfriend? Do you plan to return to your hometown to develop in the future (you were in Beijing at the time)? Do you have the confidence to be an excellent programmer? Is renting a house stressful?
The roommate answered the interviewer with "no, no, yes, yes". As a "cousin", I echoed with "no, yes, no, yes" to highlight the greatness of my roommate.
A few years later, it was said that the roommate was doing well, and the answer to the above question became "yes, yes, yes, no".

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/477573.htmlTechArticlePurely written by the author. It aims to lead everyone to use optimistic and happy experiences to learn a skill that can make a living. Note: There is no one good or bad among php, java, python, etc. The most important thing is...
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