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

将字符串拆分为php中的单词

I need to split a string to array of words by using all the non alphabetic and numeric characters(including '_') as delimiter my present code is here

$result= wordarray(preg_split("#[&,$'_.;:\s-*]# ", $data));  

AS you can see it can't work for these characters

)(@#+-*/=!~`/ \

Please help me by adding this characters to the code.

Thanks in advance.

You can use ^ as a not operator...

$result= preg_split("/[^A-Za-z0-9]/", $data);

近期文章

  • PHP Mysql Update Query无法正常工作
  • .htaccess文件夹到index.php和文件到文件
  • 文件输入在Laravel 4.2中返回null值
  • 从ConfigServiceProvider访问模型不在Laravel中工作
  • 从PHP中的json获取经度和纬度。 尝试过无效的解决方案
  • 处理两个不同的表时如何从表中删除记录
  • 提供的资源不是有效的ldap结果条目资源:ldap_get_attributes()
  • 通过Symfony的BundleExtention类设置参数,而不是使用twig global
  • 使Wordpress使用页面而不是类别
  • CodeIgniter控制器功能未触发
  • 前缀输入值
  • CakePHP加入内部
  • 播放Twilio音频文件
  • 在phonegap中运行PHP
  • 使用$ _GET变量
  • 使两个查询相互作用
  • 如何在php中生成一个新进程来调用需要子进程的节点脚本
  • 如何在doctrine2实体中禁用字符串最大长度的隐式字符串修剪?
  • 内部带有<?PHP?>标签的PHP create_function
  • Wordpress the_content显示所有页面

Copyright ©2022 我爱占星 All Rights Reserved.

浙ICP备2022030071号-1

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

友情链接:代码精华