本文執行個體講述了php實現將任意進位數轉換成10進位的方法。分享給大家供大家參考。具體如下:php將任意進位的數轉換成10進位,例如8進位轉換成10進位,16進位轉換成10進位<?php# Show the steps involved in converting a number # from any base (like octal or hex) to base 10# See below for examples, instructions and
本文執行個體講述了php從資料庫查詢結果產生樹形列表的方法。分享給大家供大家參考。具體分析如下:本代碼可以從資料庫讀取資料產生一個類似於windows的資源管理員的樹形列表<?php/* Here are the database definitions (for Solid) that i use in this code. * It should not be hard to adapt it to another database. *//*CREATE TABLE
本文執行個體講述了php實現阿拉伯數字和羅馬數字相互轉換的方法。分享給大家供大家參考。具體如下:<?php// Function that calculates the roman string to the given number:function dec2roman($f){ // Return false if either $f is not a real number, //$f is bigger than 3999 or $f is lower or equal
本文執行個體講述了php實現根據詞頻產生tag雲的方法。分享給大家供大家參考。具體如下:這裡給定一段文本,分析文本的詞頻分布,產生tag雲<?php/** * Tag cloud demo based on word frequency * @author: unknown * @since: 2007-02-27 */// Store frequency of words in an array$freqData = array();// Random words$lorem =
本文執行個體講述了php使用GD建立保持寬高比縮圖的方法。分享給大家供大家參考。具體如下:/*** Create a thumbnail image from $inputFileName no taller or wider than* $maxSize. Returns the new image resource or false on error.* Author: mthorn.net*/function thumbnail($inputFileName, $maxSize = 100
範例程式碼一:// 設定返回json格式資料header('content-type:application/json;charset=utf8');//串連資料庫$link = mysql_connect("localhost", "root", "root") or die("Unable to connect to the MySQL!");mysql_query("SET NAMES 'UTF8'");mysql_select_db("jilinwula", $link) or die(