$string = "beautiful";$time = "winter";$str = 'This is a $string $time morning!';echo $str. "";eval("$str = "$str";");echo $str;?> 複製代碼輸出:This is a $string $time morning!This is a beautiful winter morning!eval() 函數在CodeIgniter架構裡也有用到。在
class runTime {private $starTime;//開始時間private $stopTime;//結束時間private function getMicTime(){$mictime=microtime();//擷取時間戳記和微秒數list($usec,$sec)=explode(" ",$mictime);//把微秒數分割成數組並轉換成變數處理return (float)$usec+(float)$sec;//把轉換後的資料強制用浮點點來處理}public
$conn=mysql_connect("localhost","root","myoa888");mysql_select_db("lost63",$conn) or die("select db error");$sql[]="Create TABLE `lost63`.`dd_book_class` (`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,`classname` VARCHAR( 50 ) NOT NULL ,`classid`
/*簡單的目錄遞迴函式*/function tree($directory){$mydir=dir($directory);echo "";while($file=$mydir->read()){if((is_dir("$directory/$file")) AND ($file!=".") AND ($file!="..")){echo "$file";tree("$directory/$file");}else{echo "$file";}}echo "";$mydir->close();}
/*** WNiaoBlog Tag Template ShowTag** @package WNiaoBlog** @subpackage Tag*///Connect the database//include('../include/config.php');/*** CountTag() - Statistics labels appear the number,and the data to be stored in the two array** GetTag() - Access
$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