欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

PHP eval() 函數(shù)

定義和用法

eval() 函數(shù)把字符串按照 PHP 代碼來計算。

該字符串必須是合法的 PHP 代碼,且必須以分號結(jié)尾。

如果沒有在代碼字符串中調(diào)用 return 語句,則返回 NULL。如果代碼中存在解析錯誤,則 eval() 函數(shù)返回 false。

語法

eval(phpcode)
參數(shù) 描述
phpcode 必需。規(guī)定要計算的 PHP 代碼。

提示和注釋

注釋:返回語句會立即終止對字符串的計算。

注釋:該函數(shù)對于在數(shù)據(jù)庫文本字段中供日后計算而進(jìn)行的代碼存儲很有用。

例子

<?php
$string = "beautiful";
$time = "winter";

$str = 'This is a $string $time morning!';
echo $str. "<br />";

eval("\$str = \"$str\";");
echo $str;
?> 

輸出:

This is a $string $time morning!
This is a beautiful winter morning!