01c09-1.php
来自「介绍PHP5的给类型函数应用」· PHP 代码 · 共 20 行
PHP
20 行
<?php// Create an array of names we wish to test against$names = array('Robert Smith', 'Bobby Smythe', 'Roberto Thithe', 'Robin Smith');// Loop over them checking them against the name 'Roberto Smyth'$output = '';foreach ($names as $name) { similar_text($name, 'Roberto Smyth', $percent); $output .= "{$name} = {$percent}%\n";}// Now display the output with each name and its percentage similarity.// Outputs the following:// Robert Smith = 88%// Bobby Smythe = 64%// Roberto Thithe = 74.074074074074%// Robin Smith = 66.666666666667%echo "<pre>{$output}</pre>";?>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?