This is the list of the 13 PHP coding good habits, if you have better suggestions, welcome to the comments later in this article, I am a person who likes to seek knowledge
1. When querying information from the same database using SELECT, use a join
In PHP Web development, the most basic PHP environment for PHP, Apache/iis, MySQL, for the management of the database, in addition to the MYSQL database itself provides command line tools for developers to manage the database, PHP-based development
In PHP, arrays are divided into two categories: numeric indexed arrays and associative arrays.
Where the numeric index array is the same as the array in the C language, the subscript is for 0,1,2 ...
Associative array subscripts may be of any type,
reg.php
Copy CodeThe code is as follows:
Registration page
error_reporting (0);
Do not let PHP report the wrong language occurs. If not shut down well there's something like this wrong language Warning:preg_match
When we use curl to post data, we need to set the post data
curl_setopt ($c, Curlopt_postfields, $post _data);
If the $data here are
Copy CodeThe code is as follows:
$data = Array (
' Name ' = ' Scofield ',
' Time ' = ' 2012-2-3 '
)
Next, you
Then share a PHP write to get each search Spider crawl record code
Supported search engines are as follows
Records of Baidu,google,bing,yahoo,soso,sogou,yodao crawling sites can be recorded!
The PHP code is as follows
Copy CodeThe code is as
A variable is NULL considered in the following cases:
is assigned a value NULL of.
has not been assigned a value.
Be unset ().
NULLType has only one value, which is a case insensitive keyword NULL (you can write null or write null)
Problem
The company has a framework is based on Smarty write, I am responsible for the upgrade of PHP, maintenance personnel to the new environment after the test staff to ask me to make frequent errors (error: Prompted to find the file).
I traced
Core code:
Copy CodeThe code is as follows:
/*
* Function of Calculating constellation string Get_zodiac_sign (string month, String day)
* Input: Month, date
* Output: Constellation name or error message
*/
function Get_zodiac_sign ($month, $day)
See a topic on the Internet:
The result of Array ("a") +array ("B") is ___
A.array ("A", "B")B.array ("B", "a")C.array ("B")D.array ("a")
Answer: D
PHP two arrays added, why is the result still unchanged?
Because they are equivalent to array ("0″=>"
(Note not using header, JS and other methods to do the client jump)
Copy CodeThe code is as follows:
function Server_transfer ($dest)
{
Global ...; Make a list of the page variables or custom global variables you want to include in the new
A field is a property that describes the aspects of a class.
A field is a property that is used to describe an aspect of a class. It's very similar to the usual PHP variables, but there are some subtle differences, and this section describes the
There is a system method inside PHP that can invoke the command.
First create a script (metaphor/root/reboot_server.sh), re-enable.
Copy CodeThe code is as follows:
#!/bin/bash
Reboot
Give him permission again. 4755
Chown
Algorithm thinking: Each of the numbers as a separate mathematical expression, the expression with a punctuation group to synthesize a new expression, altogether 4 times, all the combinations between expressions can be implemented by recursion.
The
Copy CodeThe code is as follows:
/**
* PHP Age Calculation function
*
* Parameters support array parameter and standard Mysql date type parameter
* Params sample
* --------------------------------------------------
$BIRTHARR = Array (
' Year ' = ' 2
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