Home  >  Article  >  Backend Development  >  PHP---Understanding Grammar Notes

PHP---Understanding Grammar Notes

WBOY
WBOYOriginal
2016-07-29 09:04:13853browse

PHP is a loosely typed language

The connector "." is a dot; other languages ​​are "+";

<code>注释
PHP  //

HTML  <span><!-- --></span>CSS  /* */</code>

memory_get_usage gets the memory currently consumed by PHP

echo When outputting boolean, true outputs 1, false outputs nothing

Octal is preceded by the number 0; hexadecimal is preceded by 0x;

When the string contains quotes
1. Double quotes inside single quotes
2. Single quotes inside double quotes
3. Use escape characters

What to do when the $ character is encountered in quotation marks
1. Within double quotes, the meaning of special characters works normally (a bit like the definition in shell)
2. Within single quotes, special symbols lose their meaning

When the string is too long

Heredoc structure form

<code><<<标识符
<span>...</span><span>...</span>
标识符;</code>

Special type—resource

Open the server file and view the content. fopen() function

unset(); copy variable and clear

constant
define() function

<code><span>$p</span><span>=</span><span>"myvalue"</span>;
<span><span>define</span></span>(<span>$p</span>,<span>1</span>);
<span><span>define</span></span>(<span>"myvalue"</span>,<span>1</span>);</code>
<code>//常量如何取值

<span>$result</span>=myvalue<span>*3</span><span>*5</span>;

<span>$result</span>=constant(<span>"myvalue"</span>)<span>*3</span><span>*5</span>;</code>
<code><span>//判定常量是否被定义,返回boolean</span><span>defined($p)</span>;

<span>defiend(<span>"myvalue"</span>)</span>;</code>

System constants

<code><span>__FILE__</span>: 获取文件的物理位置
<span>__LINE__</span>:  当前代码在第几行
PHP_VERSION  解析器的版本号
PHP_OS  当前PHP版本的操作系统名称</code>
').addClass('pre-numbering').hide(); $(this).addClass('has-numbering').parent().append($numbering); for (i = 1; i ').text(i)); }; $numbering.fadeIn(1700); }); });

The above introduces PHP---Understanding Grammar Notes, including relevant content. 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