Remove PHP comments and whitespace functions

/** * Remove whitespace and comments from the code * @param string $content code content * @return String */ function Strip_whitespace ($content) { $STRIPSTR = "; Analysis of PHP source code $tokens =

PHP batch generated HTML and TXT files

$link = mysql_connect ("Mysql_host", "Mysql_user", "Mysql_password") or Die ("Could Not connect:". Mysql_error ()); mysql_query ("Set names UTF8"); mysql_select_db ("My_database") or Die ("Could not select Database"); ?>

PHP Chinese characters and 16 binary encoding conversion three ways

Conversion of Chinese characters to 16 binary encoding function Hexencode ($s) { return Preg_replace ('/(.) /es ', "Str_pad (Dechex (Ord (' \\1 ')), 2, ' 0 ', str_pad_left)", $s); } Convert 16 binary to Chinese

PHP Recursive implementation of infinite classification of PHP formatted array

Database I use MySQL PDO but the whole idea is the same. $conn =mysql_connect (' localhost ', ' root ', ' 123 '); if (Mysql_errno ()) { printf (' Connection failed '. Mysql_error ()); } mysql_select_db (' Edeng ');

PHP character transcoding Unicode encoding function

/** * $str Raw string * $encoding encoding of the original string, default GBK * $prefix encoded prefix, default "" * $postfix the encoded suffix, default ";" */ function Unicode_encode ($str, $encoding = ' GBK ',

PHP generates a transparent background image instance

!--? PHP //Transparent background image header (' CONTENT-TYPE:TEXT/HTML;CHARSET=GBK '); $safess = $_get[safe]; $dir = dirname (__file__). " /SIMSUN.TTC "; $safe =iconv ("Gb2312″," Utf-8″,

PHP Extract () function (array split) definition and usage

$a = ' Original '; $my _array = Array ("A" = "Cat", "b" = "Dog", "c" = "Horse"); Extract ($my _array); echo "\ $a = $a; \ $b = $b; \ $c = $c "; ?> Copy CodeOutput:$a = Cat; $b = Dog; $c = HorseExample 2 use all

UTF8 encoded Chinese characters into pinyin in PHP MySQL

Require_once (' pinyin_table.php '); function Get_pinyin_array ($string) { Global $pinyin _table; $flow = Array (); for ($i =0; $i<>{ if (Ord ($string [$i]) >= 0x81 and Ord ($string [$i]) { $h = Ord

PHP string comparison and lookup method

Var_dump (0 = = ' Test '); Var_dump (0 = = "); Var_dump (5 > ' t '); Var_dump (strcmp (5, ' t ')); Copy CodeThe result is (the 1th to 3rd result is wrong, only the 4th one is correct): 4bool (TRUE) bool (TRUE) bool

PHP Socket Function List

This article has shared the PHP Socket function library commonly used functions, has the research PHP socket programming friend, may refer to the study. PHP Socket Function Library:Function name Description socket_accept () accepts a socket

PHP regular filter HTML special characters

$str =preg_replace ("/\s+/", "", $str); Filter Excess return $str =preg_replace ("//si", "", $str); Note $str =preg_replace ("//si "," ", $str); Filter doctype $str =preg_replace ("//si "," ", $str); Filter HTML tags $str =preg_replace ("//si "," ",

Example of a PHP array delete element

$arr = Array (' A ', ' B ', ' C ', ' d '); Unset ($arr [1]); Print_r ($arr); ?> Copy CodeAfter trying to use unset, the array $arr should compress the array to fill the missing element position, but after Print_r

PHP Time function (time,date) usage reference

$t =time (); echo Date ("Y-m-d h:i:s", $t); Copy CodeThe format of the first parameter represents: A-"AM" or "PM" A-"AM" or "PM" D-a few days, two digits, if less than two digits before 0; such as: "01" to "D"-Day of the week, three

PHP Collation String method

This article describes the method of PHP string collation, including access to a single character, delete whitespace characters, HTML escape and other operations, the need to refer to a friend.PHP implements the access to characters in strings,

PHP Kanji transcoding Example

Querys.json: {"Cities": ["\u4e0a\u6d77", "\u4e1c\u839e", "\u4e2d\u5c71", "\u4e3d\u6c34", "\u4e4c\u9c81\u6728\u9f50", "\u4f5b\ U5c71 "," \u4fdd\u5b9a "," \u5170\u5dde "," \u5317\u4eac "," \u5357\u4eac "," \u5357\u5b81 "," \u5357\u660c "," \u535

PHP character transcoding solves the problem of garbled data of Sina crawl

function Unescape ($STR) { $str = Rawurldecode ($STR); Preg_match_all ("/(?:%u.{4}) |. +/", $str, $r); $ar = $r [0]; foreach ($ar as $k = = $v) { if (substr ($v, 0,2) = = '%u ' && strlen ($v) = = 6) $ar [$k]

PHP converts HTML into TXT file in bulk

function Html2text ($STR) { $str = Preg_replace ("/

PHP Filter String Function Example

Class Request { Public Function __construct () { if (!GET_MAGIC_QUOTES_GPC ()) { if (!empty ($_post)) { foreach ($_post as $k = & $v) { if (Is_array ($v)) { @array_walk ($v, ' urldecode ');

PHP string Lookup functions (Strrpos and STRCHR)

$str = ' 1234567890 '; $needle = ' 234 '; $result = STRCHR ($str, $needle); Var_dump ($result); copy code Result: String ' 234567890 ' (length=9) Strrpos looks for a character in the string where the last

PHP automatically creates folders and uploads files

Session_Start (); if ($_session[' company ']== ') { Exit (); } ?> $uptypes =array (' image/jpg ', ' image/jpeg ', ' image/png ', ' image/pjpeg ', ' image/gif ', ' image/bmp ', ' application/' X-shockwave-flash '

Total Pages: 5208 1 .... 3127 3128 3129 3130 3131 .... 5208 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.