Php regular expression to retrieve all links to content
This example describes how to obtain all links of the content using a php regular expression. Share it with you for your reference. The details are as follows: Here we provide two
Php converts Chinese characters to pinyin
Function Pinyin ($ _ String, $ _ Code = 'gb2312 ')
{
$ _ DataKey = "a | ai | an | ang | ao | ba | bai | ban | bang | bao | bei | ben | beng | bi | bian | biao | bie | bin
Php binary search algorithm
// $ Low and $ high have to be integers
Function BinarySearch ($ array, $ key, $ low, $ high)
{
If ($ low> $ high) // termination case
{
Return-1;
}
$
Object-oriented php operation mssql class
/*
Untested
*/
Class database_mssql {
Var $ database = NULL;
Var $ sqls = NULL;
Var $ host = NULL;
Var $ username =
Php batch recursively delete folders with Files
Php's built-in rmdir can only delete empty directories. this rrmdir can recursively delete directories and all files in the directories.
Function rrmdir ($ dir ){
If
PhpXSS security filtering code
Function remove_xss ($ val ){
// Remove all non-printable characters. CR (0a) and LF (0b) and TAB (9) are allowed
// This prevents some character re-spacing such
// Note that
Php returns relative time, such as: 20 minutes ago, 3 days ago
Function plural ($ num ){
If ($ num! = 1)
Return "s ";
}
Function getRelativeTime ($ date ){
$ Diff = time ()-strtotime ($ date );
Php uses socketpost to send data to other webservers
Function post_request ($ url, $ data, $ referer = ''){
// Convert the data array into URL Parameters like a = B & foo = bar etc.
$ Data = http_build_query ($
Php implements simple syntax highlighting functions
A simple syntax highlighted function implemented by php. note: This function is easy to design and may not be highlighted for some syntaxes. you can expand the function by yourself.
Php quickly obtains a small random array in a large number Group.
You can click another group to refresh the recommended content. First, query the database to obtain the first 1000 data records, and then randomly remove four data records.
Comparing the similarity codes of two strings in php
How to Calculate string similarity similar_text and similarity in php
$ First = "abcdefg ";
$ Second = "aeg ";
Echo similar_text ($ first, $ second); result
A php class for processing cookies
Login
Register
Subscribe to RSS
Website map
Script sharing network
// CookieClass
// Copyright (C) 2005 JRSofty Programming.
//
Php simple ftp file upload example
Example of uploading a single file to an ftp server using php
// FTP access parameters
$ Host = 'ftp .example.org ';
$ Usr = 'example _ user ';
$ Pwd = 'example _ password ';
Use PHP to scale up or down images
Function resizeimage ($ srcfile, $ mySize ){
$ Size = getimagesize ($ srcfile );
Switch ($ size [2]) {
Case 1:
$ Img = imagecreatefromgif ($
Php compresses the file into a zip file
PHP ZipArchive is an extension class that comes with PHP. it can easily compress and decompress ZIP files. before using it, make sure that the php zip extension is enabled.
/*
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