Php str_split Function Example

PHP 8 , PHP

Nicesnippets

308

02-08-2021


Hi Guys,

In this example,I will learn you how to string every character to convert into array in php.you cab easy and simply string every character to convert into array in php.

So, let's see bellow very simple example here:

Example:


<?php

$name = "Nicesnippets";

$arr = str_split($name);

print_r($arr);

?>

Output:

Array

(

[0] => N

[1] => i

[2] => c

[3] => e

[4] => s

[5] => n

[6] => i

[7] => p

[8] => p

[9] => e

[10] => t

[11] => s

)

It will help you...