php 将字符串按大写字母分隔成字符串数组

yipeiwu_com6年前PHP代码库
alert("createTechBook".split(/(?=[A-Z])/)) 谢了啊
复制代码 代码如下:

<?php
$str="abcDefGhi";
/*
preg_match_all("/([a-zA-Z]{1}[a-z]*)?[^A-Z]/",$str,$array);
*/
$array=preg_split("/(?=[A-Z])/",$str);
print_r($array);
?>


复制代码 代码如下:

<?php
$string = "createTechBook";
$arr = preg_split("/(?=[A-Z])/", $string);
print_r($arr);
?>

也可以

相关文章

php str_pad 函数使用详解

string str_pad ( string , int pad_length , string pad_string , int pad_type); string 指定字符串,pa...

php GeoIP的使用教程

GeoIP介绍: 什么是GepIP ? 所谓GeoIP,就是通过来访者的IP, 定位他的经纬度,国家/地区,省市,甚至街道等位置信息。这里面的技术不算难题,关键在于有个精准 的数据库。有...

PHP连接操作access数据库实例

因为之前做的PingSwitch要做一个WEB展示的前端,因为一开始用了Delphi和access的结构,而Delphi与MySQL的连接又相对麻烦,最后只能选择用PHP+Access的...

php实现扫描二维码根据浏览器类型访问不同下载地址

<?php $Agent = $_SERVER['HTTP_USER_AGENT']; preg_match('/android|iphone/i',$Agent,$m...

Windows平台PHP+IECapt实现网页批量截图并创建缩略图功能详解

Windows平台PHP+IECapt实现网页批量截图并创建缩略图功能详解

本文实例讲述了Windows平台PHP+IECapt实现网页批量截图并创建缩略图功能。分享给大家供大家参考,具体如下: 最近在开发一个本地互联网应用的项目,为了增加用户体验,需要在搜索结...