An example
Example 1
"Http://www.w3.org/TR/html4/loose.dtd" > Apply the substr () function to intercept characters of a specified length in a string echo substr ("www.goodby.com", 0);//intercept from NO. 0 characterecho "";echo substr
Basic syntax:
Const constant NAME = value;
How to access:
Class Name:: Constant Name or interface name:: Constant Name
Attention:
1 The constant name should be all uppercase, and the preceding cannot have the $ symbol, the constant must have an
Chinese-English character interception
/*** Intercept Chinese and English characters* Enter description here ...* @param unknown_type $str* @param unknown_type $start* @param unknown_type $length* @param unknown_type $charset* @param unknown_type
1, the function of the formal parameters can have more than one
2. The data type of the formal parameter can be any type supported by PHP.
3. The name of the function, like a custom variable, must begin with a letter or an underscore.
4, the
1. Manually escaping and restoring strings
Echo ' select * from emp where name=\ ' john \ ';
?>
Output: SELECT * from emp where name= ' John '
2. Use functions to escape and restore strings
(1) addslashes () function: To add a backslash to a
Example 1: Write a program that can receive an integer that prints half of the pyramid.
For ($i =0 $i
for ($t =0; $t
Echo ' * ';
}
echo ' ';
}
?>
The effect of the following figure:
Example 2: Print a solid pyramid.
Analysis:
Multiple-spoke statement syntax:
if (conditional expression) {
Statement
}else if (conditional expression) {
Statement
}
......
else{
Statement
}
Example: Write a program to determine the age, if
Practical paging class in php and practical paging class in php
Region Code region name parent Code Include ("LZY. class. php ");$ Db = new LZY ();Include ("page. class. php ");// Check the total number of items$ Sz = "select count (*) from
Php custom truncation of Chinese strings-utf8 version,
Note: There are a lot of code for this problem on the Internet, but many of them are copied and pasted without practice, and the code has logic problems. The following code is compiled by myself.
PHP Learning 1-PHP file processing,
Include and require in PHP
The Php include (or require) Statement obtains all the text, code, and tags in the specified file and copies them to the file using the include statement.
This means that you can create
[PHP series] PHP recommended standard PSR-3, logging interface, psr-3 Logging
The last section talked about PHP official code specifications, the following to bring you the PHP series of PHP recommended standard of the other two, PSR-3, PSR-4.
First
Browsersync introduction and use, browsersyncandIntroduction
Time-saving browser synchronization test tool. Browsersync allows the browser to respond to your file changes (html, js, css, sass, less, etc.) in real time and automatically refresh the
Switch the php version from brew to macbrew and from macbrew to php.The first step is to install brew Brew, which is a package management tool under Mac. You can install the development tool conveniently by hosting Mac-compatible compilation
PHP basic learning (function 1) and php basic learning functions
PHP (Hypertext Preprocessor): Hypertext Preprocessor, a scripting language embedded in HTML and running on the server.
Var_dump -- print variable information
Note:
This function
For some experiments on curl/curl_multi, curlcurl_multi
I haven't written it for a few days. I am mainly engaged in my own learning process. paste some code of curl/curl_multi_exec and mark it.
$ handler) {echo $ url. "========= ". $ handler. "\ r \
PHP editor PhpStrom running is slow, php editor phpstrom
Recently, when using phpstorm for development projects, no matter how large the file is to be loaded and run, if there is a large amount of project file data, phpstorm can be stuck to a dead
Nullfalse
There may be useful judgments:
1. String and 0 judgment
This value is determined by the first part of the string. If a string starts with a valid number, use this number as its value. Otherwise, its value is 0 (0 ).That is to say, '1fff'
The thinkphp page becomes invalid after the parameters passed through the Page Link are obtained once.
In thinkphp, parameters passed through the Page Link are obtained once and then invalid. ajax cannot be used again internally. To use it, you
[Linux] PHP programmers play with the Linux series-lnmp environment, linux-lnmp
1. PHP programmers turn to the Linux series-how to install and use CentOS
In my normal work, I often build an environment as a PHP programmer. In this environment, I
PHP text read/write,
1 $ x_value) {// looping array 25 if ($ keyCompare = $ x) {// if the first 17 bytes are the same, output the row of the array (the array is matched) 26 echo $ x_value; 27 fwrite ($ txtWriteContent, $ x_value ); // write the
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service