Common string comparison functions in php

The substr_compare () function compares two strings from the specified start length.This function returns:0-if the two strings are equal> 0-if string1 (starting position) is greater than string2SyntaxSubstr_compare (string1, string2, startpos,

Php character comparison function similar_text strnatcmp strcasecmp

The similar_text () function calculates the number of matching characters for two strings.This function can also calculate the similarity between two strings (expressed in percentages ).SyntaxSimilar_text (string1, string2, percent)Note: The

Php judges the position of a string in another string

$ Email = 'User @ example.com '; // defines the string$ Result = strstr ($ email, '@'); // returns a substring.Echo $ result;/*The strstr () function searches for the first occurrence of a string in another string.This function returns the rest of

Php convert_uuencode () and convert_uuencode functions

The convert_uudecode () function decodes uencode-encoded strings.SyntaxConvert_uudecode (string)*/$ Str = ", 2 & 5l; & // @ = v] r; & 0a'"; // defines the uencode encoded string$ Result = convert_uudecode ($ str); // decodedEcho $ result; // output

Php addslashes SQL anti-injection function

// 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 ($

Php retrieves array value array inverted key name Operation instance

*/$ Array = array ("size" => "xl", "color" => "gold"); // defines an arrayPrint_r (array_values ($ array); // outputs all values of the array./*Definition and usageThe array_values () function returns an array containing all the key values in the

Current next reset function in php

$ 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

Commonly used array operations in php array split times key-name difference set

//$ 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_

Php array operation example 3

*/$ Array1 = array ("a" => "green", "red", "blue ");$ Array2 = array ("B" => "green", "yellow", "red ");$ Result = array_intersect ($ array1, $ array2); // calculates the intersection and assigns a valuePrint_r ($ result );//$ Search_array = array ('

Php ob_flush flush output cache instance and description

Php Tutorial ob_flush flush output cache instance and description*/Ob_flush ();//Flush ();//Function flush (){Echo (str_repeat (''', 256 ));// Check that buffer is actually set before flushingIf (ob_get_length ()){@ Ob_flush ();@ Flush ();@

Several php methods for deleting array elements

Let's take a look at the complete deletion of duplicate array instances. The code is as follows:Copy code // Delete an element from the arrayFunction array_remove_value (& $ arr, $ var ){Foreach ($ arr as $ key => $ value ){If (is_array ($ value

Php string length function

Php strlen () functionDefinition and usageThe strlen () function returns the length of the string.SyntaxStrlen (string) parameter descriptionString is required. Specifies the string to be checked. The code is as follows:Copy code Echo strlen

Php regular expression verification number

Non-negative floating point number (positive floating point number + 0): ^ d + (. d + )? $Positive floating point number ^ ([0-9] +. [0-9] * [1-9] [0-9] *) | ([0-9] * [1-9] [0-9] *. [0-9] +) | ([0-9] * [1-9] [0-9] *) $Non-positive floating point

Php Chinese processing functions

PHP functions that convert traditional Chinese to Simplified Chinese

A few days ago, I asked the oso forum if there was any source code and no one replied. Finally, I made up my mind to transplant such a function and thanked the netizen Keyes for providing the Delphi source code for transplantation. The call method

Useful php functions

Some useful functions can be saved as source code, and you can avoid writing them again later.File read function// File read functionFunction PHP_Read ($ file_name ){$ Fd = fopen ($ file_name, r );While ($ bufline = fgets ($ fd, 4096 )){$ Buf. = $

Php interview question 1

* Implement a function. Input a piece of text and parse the text into an array. The key of each element in the array line is specified by the input parameter.Function prototype: function ExplodeLines ($ text, $ columnNames)For example, enter: The

Several effective methods for php to get the file suffix

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

Tutorial on controller instances in php mvc

The code is as follows:Copy code $ Route-> run ();/*** Execute the corresponding MCA        **/Private function run ()       {$ FilePath = APPLICATION_PATH. '/controller/'. $ this-> _ moudle. '/'. $ this-> _ conttoller. '. inc. Php ';$ IsNo =

Php loop control statement

Foreach statementThe Foreach loop is introduced in php4.0 and can only be used as an array. In php5, object support is added. The syntax format of this statement is:Foreach (array_expression as $ value)Statement;Or The code is as follows:Copy code

Total Pages: 12780 1 .... 9377 9378 9379 9380 9381 .... 12780 Go to: GO

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.