PHP FILTER_CALLBACK 是一款過濾器,該過濾器為我們提供了對數據過濾的完全控制。
定義和用法
- Name: "callback"
- ID-number: 1024
提示和注釋
實例 1
<?phpfunctionconvertSpace($string){returnstr_replace("","_",$string);}$string="Peterisagreatguy!";echofilter_var($string,FILTER_CALLBACK,array("options"=>"convertSpace"));?>
實例 2
<?php$string="Peterisagreatguy!";echofilter_var($string,FILTER_CALLBACK,array("options"=>"strtoupper"));?>