PHP Bubble Sorting algorithm implementation Code _php tutorial

Copy CodeThe code is as follows: $arr = Array (345,4,17,6,52,16,58,69,32,8,234); for ($i =1; $i For ($j =count ($arr)-1; $j >= $i; $j-) { if ($arr [$j]$temp = $arr [$j-1]; $arr [$j-1] = $arr [$j]; $arr [$j] = $temp; } } } Basic Concepts

_php tutorial on the problem of the formal participation arguments of functions in PHP

When the number of arguments When the number of formal parameters, PHP will not error, it will only take the previous several parameters, the excess will be discarded. When you write a function in PHP, the function is normally called, and the

PHP website anti-IP attack code, Super Practical _php Tutorial

Today, I developed the following code, is the first, a day to intercept 15 IP, the server load is normal. Copy CodeThe code is as follows: Query prohibit IP $ip =$_server[' remote_addr ']; $fileht = ". Htaccess2"; if (!file_exists ($fileht))

PHP code for incrementing strings _php tutorial

A classmate asked a question: Copy CodeThe code is as follows: for ($i = ' A '; $i echo $i; } What is the output? The output is: Copy CodeThe code is as follows: Abcdefghijklmnopqrstuvwxyzaaabacadaeafagahaiajakalamanaoapaqaras ..... Why? In

Regular expression Collation _php tutorial under PHP

---------------------------------------------------------Regular Collection Mobile Number: $mode = "/^1[358]\d{9}/"; e-mail address: $mode = "/^[a-z][-_\."? [A-z\d]*@[a-z0-9]+[\.] [A-z] {2,4}/i "; --------------------------------------------------

PHP visitfile () traverse the specified folder function _php Tutorial

Note: Visitfile () has minor modifications Copy CodeThe code is as follows: View files for a specified folder $fileList = Array (); function Visitfile ($path) { Global $fileList; $path = str_replace ("\ \", "/", $path); $fdir = Dir ($path); while (

Discuz uchome ajaxpost Tips _php Tutorial

such as the default submit button: onclick= "Ajaxpost (' Formid ')"; sort of, we can do this first. Onclick= "$ (' __formid '). innertext= '; Ajaxpost (' formid '); Checkpostresult ();"; The meaning is actually very simple, first the Ajaxpost tip

Linux Delete code for 7 days ago log (Php+shell) _php Tutorial

PHP Version: Copy CodeThe code is as follows: /** * Delete logs from 7 days ago * @param $logPath */ function Del7daysagolog ($logPath) { if (empty ($logPath)) return; $handle = Opendir ($logPath); while (($file = Readdir ($handle))!== false)

PHP High Performance Writing _php tutorial

From. NET to do PHP4 years, and recently began to pursue high performance ~ ~ So I started to think it was time to write a blog. Come and find something first ~ Copy CodeThe code is as follows: $arr = Array ( ' Attr1 ' = 1, ' Attr2 ' = 1, ' Attr3 '

PHP Cookie Operation implementation code (login) _php Tutorial

First file login_frm.php This is the login windowCode Copy CodeThe code is as follows: The second file login.php This is the process login Copy CodeThe code is as follows: if ($_post[' username ') = ' admin ') { Setcookie (

The most commonly used custom function collation _php Tutorial in PHP project development

Alert hint Function alert ($msg) { echo ""; } Convert some pre-defined characters to HTML entities function D_htmlspecialchars ($string) { if (Is_array ($string)) { foreach ($string as $key = = $val) { $string [$key] = D_htmlspecialchars ($val); } }

PHP to get discuz Forum login user name, user group, user ID and other information implementation Code _php tutorial

Here is an easy way to log in directly using Discuz's include/common.inc.php. Copy CodeThe code is as follows: Include_once (".. /discuz/include/common.inc.php "); $CTDF _userinfo = Array (); $CTDF _userinfo["sid"] = $sid; $CTDF _userinfo["UID"] = $

Implementation code for using post to pass string redirection in PHP _php tutorial

Copy CodeThe code is as follows: $ch = Curl_init (' http://domain-name.com/page.php '); curl_setopt ($ch, Curlopt_post, 1); curl_setopt ($ch, Curlopt_postfields, "Form_id=295&name=$_post[name]&email=$_post[email]&phone=$_post

A simple way to combine arrays with plus signs in PHP share _php tutorials

Code: Copy CodeThe code is as follows: $a = Array (' a ' = = ' A ', ' B ' = ' B '); $b = Array (' c ' = = ' C ', ' d ' = ' d '); $c = $a + $b; Print (' Print (''); ?> Results: Copy CodeThe code is as follows: Array ( [A] = a [B] = b [C] = C [d]

Views rows style Template rewrite code _php tutorial

The following is a code example. Copy CodeThe code is as follows: $nid = $row->nid; $country = Db_result (db_query (' SELECT name ' from {term_data} term_data JOIN {term_node} term_node on term_node.tid = Term_d Ata.tid WHERE Term_data.vid =%d and

PHP using transactions in PDO (Transaction) _php Tutorial

And, in the course of execution, if one of the executions fails, you can roll back all the changed operations. If the execution succeeds, the sequence of operations will be permanently valid. The transaction solves the problem of being out of sync

Allow PHP cookies to take effect immediately and use the _php tutorial without refreshing

Copy CodeThe code is as follows: The PHP cookie setting function takes effect immediately. function Cookie ($var, $value = ', $time =0, $path = ', $domain = ') { $_cookie[$var] = $value; if (Is_array ($value)) { foreach ($value as $k = = $v)

How to install Configuration FCKeditor Editor under PHP _php tutorial

First, PHP calls the FCKeditor method. Second, JS call FCKeditor method. Copy CodeThe code is as follows: Require_once (Path_pre. " Fckeditor.php "); Contains the FCKeditor class, $oFCKeditor = new FCKeditor (' content '); Create a FCKeditor

PHP 5.3.5 Installation memcache Considerations Summary _php Tutorial

Install PHP Extensions: memcache steps under Windows 1. Download the PHP extension dll:http://downloads.php.net/pierre/ (If the above directory does not conform to your PHP compiled version of the DLL to go to Google, there will be a lot of

PHP generates random number of two methods instance code output random ip_php tutorial

I am an ASP programmer, this is the first time to write a PHP program, a little bit of experience sent up to share Copy CodeThe code is as follows: $ip 2id= Round (rand (600000, 2550000)/10000); The first method, the direct generation of $ip 3id=

Total Pages: 5208 1 .... 4786 4787 4788 4789 4790 .... 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.