Php Tutorial

Discover php tutorial, include the articles, news, trends, analysis and practical advice about php tutorial on alibabacloud.com

php $ HTTP_COOKIE_VARS Instance voting information restrictions

php tutorial $ http_cookie_vars Example Voting limit if ($ http_cookie_vars ["vote"]) {echo "<script> alert ('You have voted, please do not repeat the vote'); history.back (); </ script > "; exit;} $ vcount = $ _ pos ...

PHP excludes weekends and Holidays program instance code

PHP tutorial excludes weekend and holiday program instance Code date_default_timezone_set (' PRC '); /** * The date after a certain number of days from a date, * excluding Saturday Sundays and holidays * @param $start start date * @param $offset ...

PHP easiest to get array last no element value

? PHP Tutorial The easiest way to get an array of the last element-free value/method A $url = ' www.jzread.com.cc '; $TMPURL = Explode ('. ', $url);//output Temurl see Print_r ($TMPURL); /* Result: Array ([0] => www [1] => 11 ...

php filter illegal character function

php tutorial to filter illegal character function $ str = "<a> fdafsa '' & # x </a>"; echo htmlspecialchars ($ str); / * & (and) into & amp; ; <(Less than) turn into <> (greater than) turn into & g ...

PHP refers to all pages as a domain name 301 permanent Turn Code

/php tutorial All pages are referred to as a domain name 301 permanent to the Code $SN = strtolower ($_server[' server_name ']?$_server[' server_name ']:$_server[', ' http_host ') ); $query = Trim (@$_server[' Request_uri ')); $SN = Str_replace (' http://', ', ', strtolowe ...)

PHP Traversal Object Properties Two ways

PHP Tutorial Traversal Object Properties Two methods * * This article we want to provide you with two kinds of traversal object property methods, and illustrate the traversal object properties in PHP application.     * * class Foo {private $a;     public $b = 1;     Public $c; P ...

php str_replace single quotation marks double quotation marks difference

A specific overview of the str_replace () function in php str_replace ($ search, $ replace, $ subject) Example 1 str_replace ("n", "", '465s4d6f5s4ad1as65d4fa6sn54df65sdafgsdfn65g4sd65g4hdf6n54ghd6fbghdfgh'); ...

PHP code to empty the HTML tags in the string

This article describes PHP empty string html tags Tag: HTML, HTML, HTML Category: html function clear_html_label ($ html) {$ search = array ("'<script [^>] *?>. *? </ script & g ...

php mktime Calculate the difference between two time

mktime = mktime ($ hours, minute, seconds, month, day, years) $ start_time = mktime (0,0,0,01,09,2010); // start time $ end_time & n ...

php filter non-site links

This tutorial is a use php regular expressions to filter non-site link instance. * / php $ neirong = preg_replace ("/ <a (?! [^ <>] *? [^ <>] *?>). *? </a> / si", "", $ bbb); echo $ neirong; Method two $ str = '& ...

php date () Convert mktime () into readable date

The date / time function allows you to extract and format the date and time on the server The mktime () function returns a unix time stamp of the date. The parameter always represents the gmt date, so is_dst has no effect on the result. Arguments can be left blank from right to left, and empty parameters set to the corresponding current gmt value. Syntax mktime (hour, minute, second, month, day, y ...

php produces arbitrary length string + numeric random number of code

Can customize what kind of string and how long [PHP] Code function random ($ length) {$ hash = ''; $ chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz'; $ max = strlen ($ chars) - 1; mt_s ...

php regular expression replacement and regular replacement function

We will use the regular replacement function preg_replace, the following example is the text has a The following tag <img style src = "<? = $ Url?> / Images / styleno.jpg" width = "30" height = "30 & ...

php max () min () Returns the maximum and minimum values

max () returns the maximum value. Syntax max (x, y) Parameter Description x Required. A few. y necessary. A few. Description max () Returns the value with the highest value in the argument. If there is only one parameter and an array, max () returns the largest value in the array. If the first argument is an integer, string, or floating point number, at least two arguments are required and max () returns the largest of these values. You can compare an unlimited number of values. echo max (1,3,5,6,7); & ...

php generates a random number mt_rand () rand () mt_srand () function

mt_rand () Returns a random integer using the mersenne twister algorithm. Syntax mt_rand (min, max) Description mt_rand () returns a pseudo-random number from 0 to rand_max if the optional parameters min and max are not provided. For example, want a random number between 5 and 15 (including 5 and 15), using mt_rand (5, 15). * / echo mt_rand (); & nb ...

php dynamically generated pie chart code

* / // Create an image $ image = imagecreatetruecolor (300,300); // Define the color you want to draw the pie chart $ white = imagecolorallocate $ image = 0x0 0xff 0xff $ gray = imagecolorallocate $ image 0xc0, 0xc0, 0xc0); $ darkgray = imagecolorallocate (...

php fread function and fread function usage

fread (resource $ handle, int $ length) The length of the byte read by fread () is handled by the file pointer of the reference. Read as soon as possible to one of the following conditions: The length of the bytes that have been read! Eof (end of file) Reaches a packet of available network (stream) has been read 8192 bytes (open user space stream) * / // fread read File instance one ...

Generate a random string, including uppercase, lowercase, numeric php code

Generate a random string, including uppercase and lowercase letters and numbers. Function randstr ($ length) {$ hash = ''; $ chars = 'abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz'; $ max = strlen ($ chars) - 1; mt _...

PHP using regular expressions to verify the Chinese problem

str = People's Republic of China 123456789abcdefg; Echo preg_match ("/ ^ [u4e00-u9fa5_a-zA-Z0-9] {3,15}", strName); Run this code above to see what tips? Warning: preg_match (): Compilation failed: PCRE does not support L, l, ...

PHP single and double quotes difference

Single quote within the variable does not execute double quotes will be executed, such as $ name = 'hello'; Echo "the $ name"; Will output the hello And if the single quotation marks $ name = 'hello'; echo 'the $ name' The main difference that will output the $ name is this.

Total Pages: 4 1 2 3 4 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.