我爱占星网 我爱占星网
首页
编程
java
php
前端
首页 编程 java php 前端

删除仅包含特殊字符的数组

How can I remove all elements from an array that contain only special characters (such as ., * etc...).

function only_specialchars($string) {
    if (preg_match("/[a-z0-9]/i", $string)) {
        return false;
    } else {
        return true;
    }
}

$filtered = array_filter($array, "only_specialchars"));

Something like this? This will filter all words that do not contain characters or numbers.

近期文章

  • php json解码curl_exec在Facebook上共享链接的结果
  • 在echo中插入数组[关闭]
  • 长期民意调查造成巨大延迟[关闭]
  • 拿网址并解析其中的一部分[重复]
  • 使用PHP使用用户输入填充URL字段
  • 为特定网站制作php文件功能
  • jquery数据表按字母顺序添加新行
  • Love you Ten thousand years 的编写
  • Find a way 寻找方式的问题
  • Cry,men,not crime 怎么来做的
  • Tears of lonely star 怎么写的
  • Say love to you once again 的解法求助
  • 从小到大的顺序输出这三个字符
  • 给你一个整数区间[a,b],请你求出该区间的x使g(x)最大
  • 棋盘分割 正确解法
  • Python 创建Dog类时 报错AttributeError: 'Dog' object has no attribute 'sit'
  • 为什么用gets函数会自动加一个空格?
  • 有人可以解释这些if语句的含义吗? [关闭]
  • 发送电子邮件给用户也在php中输入他/她的详细信息
  • .repsonseText返回空字符串

Copyright ©2022 我爱占星 All Rights Reserved.

浙ICP备2022030071号-1

部分图文来自网络,如有侵犯您的版权,请告诉我们删除

友情链接:代码精华