//資料庫操作類class db{ //SQL執行後的資料儲存變數; var $db; //讀取或設定當前資料的位置 var $position=0; //執行SQL語句並把結果儲存為db變數中; function sub_sql($str) { global $prefix;//全域函數,表首碼 return str_replace("#@__",$prefix,$str); } function
$foo = 'Bob'; // 將 'Bob' 賦給 $foo$bar = &$foo; // 通過 $bar 引用 $fooecho $foo.'';$bar = "My name is $bar"; // 修改 $bar 變數echo $bar.'';echo $foo.''; // $foo 的值也被修改?>複製代碼輸出:BobMy name is BobMy name is
/***************@length - length of random string (must be a multiple of 2)**************/function readable_random_string($length = 6){$conso=array("b","c","d","f","g","h","j","k","l","m","n","p","r","s","t","v","w","x","y","z");$vocal=array("a","e",
$stid = isset($_GET['stid'])?$_GET['stid']:0;$endid = $stid + 100;$maxid = 10000;function dosomething(){//要時間比較多的操作……}$sql_string=”select * from `table` where id>’$stid’ and id$datas = getdata_bysql($sql_string);foreach($datas as
// Original PHP code by Chirp Internet: www.chirp.com.au// Please acknowledge use of this code by including this header.function myTruncate($string, $limit, $break=".", $pad="...") {// return with no change if string is shorter than $limitif(strlen($
/** * Miscellaneous utility methods. */final class Utils { private function __construct() { } /** * Get IP address * @return string IP address string */ public static function getIpAddress() { return