Convert a String into an Array of Characters

前端 未结 7 1279
陌清茗
陌清茗 2020-11-29 08:05

In PHP, how do I convert:

$result = "abdcef";

into an array that\'s:

$result[0] = a;
$result[1] = b;
$result[2] = c;         


        
7条回答
  •  北荒
    北荒 (楼主)
    2020-11-29 08:25

    You will want to use str_split().

    $result = str_split('abcdef');
    

    http://us2.php.net/manual/en/function.str-split.php

提交回复
热议问题