search
Homephp教程php手册PHP 字符串转换成数组str_split

PHP 字符串转换成数组str_split

将连续的字符串转换成单个的字符数组

例子:

<?php
    $str = &#39;abcde&#39;;
    $arr1 = str_split($str);
    print_r($arr1);
?>

输出结果如下:

Array
(
    [0] => a
    [1] => b
    [2] => c
    [3] => d
    [4] => e
)

其与explode的区别是:explode第一个参数必须传一个切分字符(如:,  |  空格 )才能进行分割;str_split则直接进行分割

更多相关教程请访问 php编程从入门到精通全套视频教程

Statement
This article is reproduced at:CSDN博客. If there is any infringement, please contact admin@php.cn delete

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function