Conditional statement
When you write code, you often need to perform different actions for different judgments.
You can use conditional statements in your code to accomplish this task.
If...else statement
Executes a piece of code when the
1. Simple syntax rules (use curly braces to define variable names for all versions of PHP):
Copy Code code as follows:
$a = ' flower ';
echo "She received some $as";/invalid; the letter S is used as an element of a valid variable
The examples in this article describe how PHP gets all the dates between the start and end dates. Share to everyone for your reference, specific as follows:
/**
* Gets the date of each day in the specified date
* @param date $startdate
Copy Code code as follows:
Class Ctbclass {
var $file;
var $index;
Create a file and write input
function Null_write ($new)
{
$f =fopen ($this->file, "w");
Flock ($f, LOCK_EX);
Fputs ($f, $new);
Fclose ($f);
}
Add data log to
Macromedia Company's Flash Animation software has become a very popular performance tool on the Web page, the website developer uses it to arouse the interest of the visitor. Unfortunately, only using ActionScript to create animations is very
Problem:
A lamp server running on line, PHP does not support iconv functions.
Workaround:
Install LIBICONV, recompile Apache, enable PHP to support Iconv functions, implement UTF-8 and gb2312 encoded conversions.
Specific steps:
1, download
This example describes the PHP read configuration file class instance. Share to everyone for your reference. as follows:
_settings;
foreach ($var as $key) {if (! isset ($result [$key])) {return false;
} $result = $result [$key];
return $
Brief introduction:Blitz templates is a fast PHP template engine developed in C, which is an extended function of PHP. It started as a php_templates replacement, but developed to more work. It is based on an Extensible template controller (custom
PHP variable reference and variable destruction mechanism
In PHP, the symbol "&" denotes a reference.
1, to see if the situation is not quoted this way:
$a = "Hello world";//define a variable, the following assignment to $b
$b = $a;//This
PS: The previous period of time configuration php-fpm, inadvertently found that it has two kinds of process management methods. Like Apache, its number of processes can be divided into dynamic and static depending on the settings.
PHP-FPM currently
A small program that uses PHP to open the socket port directly for a letterThe feature is the use of SMTP authentication, can better use to meet the needs of general users to build stations.
The entire source code attached to this article, the same
This article summarizes the PHP practical code fragment. Share to everyone for your reference, specific as follows:
A keyword extraction from the Web page
$meta = get_meta_tags (' http://www.jb51.net/');
$keywords = $meta [' keywords
Arsort an array in descending order and maintains an indexed relationship.
Basic syntax
BOOL Arsort (array & $array [, int $sort _flags = sort_regular])
This function is sorted in descending order, and the index of the array is persisted and the
Translator Note: This article is formerly known as "Creating a multi-file Upload Script in PHP." I think this article is generally written, the code is not very professional, but it is relatively short, and a time can not find a better article, the
After understanding some of the basic PHP information, the first thing to do is to install PHP, software is not installed how to learn it? There is a gold combination in PHP, it is lamp.
What is lamp:
L:linux
A:apache
M:mysql
p:php
Features: Open
Common PHP string processing function usage example [conversion, escape, truncation, comparison, search, reverse, CUT], example escape
This article analyzes common PHP string processing function usage. We will share this with you for your reference.
Output stringIn PHP, there are four methods to output strings. The echo structure can output multiple values at a time; print () can only output one value; printf () can format the output; print_r () can output arrays, which is very beneficial for
Before the function, the error message is not displayed.The preceding "@" can suppress the error, that is, it will not display the error, and then throw an exception to display the exception processing defined by itself. This is only added to
Three element operators in the php TutorialThe functions of the ternary operator are the same as those of the "if... else" flow statement. It is written in one line, and the code is refined and the execution efficiency is high. The proper use of
Ini_set ('include _ path', CAKE_CORE_INCLUDE_PATH. PATH_SEPARATOR. ROOT. DS. APP_DIR. DS. PATH_SEPARATOR. ini_get ('include _ path '));We can see that this program dynamically modifies include_path. However, cake adds CAKE_CORE_INCLUDE_PATH and
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