<?php
function convertSpace($str) {
return str_replace(' ', '_', $str);
}

$str = 'i am a great guy!';

echo filter_var($str, FILTER_CALLBACK, array('options'=>'convertSpace'));
echo filter_var($str, FILTER_CALLBACK, array('options'=>'strtoupper'));

//验证email
$email = 'xxx@dabaidu.com';
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
echo 'email is not valid';
} else {
echo 'email is valid';
}

相关文章:

  • 2022-12-23
  • 2021-11-11
  • 2021-07-16
  • 2021-05-29
  • 2021-10-22
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-12-21
  • 2022-12-23
  • 2021-10-28
  • 2021-07-13
  • 2021-07-09
  • 2021-10-25
  • 2022-12-23
相关资源
相似解决方案