The filter_sanitize_number_int filter deletes all invalid characters in the number.This filter allows all numbers and + -.*/$ Number = "5-2 + 3 pp ";Var_dump (filter_var ($ number, filter_sanitize_number_int ));/*Verification Number: ^ [0-9] *
*/$ Str = "hello world"; // define a string$ Result = str_word_count ($ str); // you can specify the number of words.Echo $ result; // output resultEcho " ";$ Result = str_word_count ($ str, 1); // returns an arrayPrint_r ($ result); // output
// The parameter 'A. Z' defines that all uppercase and lowercase letters are escaped.Echo addcslashes ('foo [] ', 'A. Z'); // output: foo []//$ Str = "is your name o 'Reilly? "; // Define a string, including characters to be escapedEcho addslashes ($
$ Array = array ('step one', 'step two', 'step three ', 'step four'); // defines an arrayEcho current ($ array). " n"; // returns the first element of the array.Next ($ array); // The array pointer moves one bit behindNext ($ array); // The array
//$ Array = array (, =>, 3 => 13); // create an arrayPrint_r ($ array); // outputs the array content//$ A = array ('green', 'red', 'yellow'); // defines the first array.$ B = array ('avcado', 'apple', 'bana'); // defines the second array.$ C = array_
/*************************************** ******************************************* Email: njj@nuc.edu.cn *************** ******** Date: 2004/10/02 ******************* ********* Reserve the copyright information when you reprint it *****************
The concept of object-oriented programming:Different authors may have different ideas, but an OOP language must have the following aspects:Abstract data types and information encapsulationInheritancePolymorphismIn PHP, classes are encapsulated:Class
Principle: read the source files of a website and analyze the source code using regular expressions to obtain all links./********** Qiushuiwuhen (2002-5-20 )***********/If (empty ($ url) $ url = "http://www.111cn.net/expert/"; // Set url$ Site =
Today we will teach you how to upload images to the MYSQL database using PHP. In this tutorial, we need to create three php files:Readdir. php-code for storing images in the databaseImage. php-code for displaying the actual imageView. php-show how
PHP implements five basic operations on text databases: data display, addition, modification, deletion, and query.I used a message book program as an example to illustrate how PHP can display, add, modify, delete, and query data in a text
PHP operatorsNext, let's take a look at the arithmetic, string, logic, comparison, and other operators of PHP3.1. Arithmetic operators+: $ A $ B plus $ a plus $ B-: $ a-$ B minus $ a minus $ B *: $ a * $ B multiply $ a by $ B /: $ a/$ B except $ a
Use pathinfo functions The code is as follows:Copy code Function extend_2 ($ file_name){$ Extend = pathinfo ($ file_name );$ Extend = strtolower ($ extend ["extension"]);Return $ extend;} Definition and usageThe pathinfo () function returns the
The code is as follows:Copy code Switch (variable ){Case value1:Statement1;Break;Case value2:...Default:Defulat statement;} The switch statement is compared with the value in case based on the value of variable. If the value is not equal,
Note: list () can only be used as an array of numeric indexes. It is assumed that the numeric index starts from 0.Example 1. list () example The code is as follows:Copy code $ Info = array ('Coffee ', 'Brown', 'Caffeine '); // Listing all the
1. Pass the _ GET parameter to determine the webpage request.The url is passed as follows: *******. php? AjaxPhp's judgment:If (isset ($ _ GET ['Ajax ']) {... This is an ajax request, and then...}Else {... This is not an ajax request, 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