PHP filter 函数FILTER_CALLBACK 过滤数据

<?php
function convertSpace($string)
 {
 return str_replace(" ", "_", $string);
 }

$string = "Peter is a great guy!";

echo filter_var($string, FILTER_CALLBACK,array("options"=>"convertSpace"));
echo '<br>';
echo filter_var($string,FILTER_CALLBACK,array("options"=>"strtoupper"));

?>

Peter_is_a_great_guy!
PETER IS A GREAT GUY!

原文地址:https://www.cnblogs.com/dangkei/p/3954053.html