How do I convert a three digit integer to an array so that each digit is in its own element?


In this article, I will show how to convert a three digit integer to an array so that each digit is in its own element.
we are using php str_split() Function.

PHP str_split() function :
The str_split() function splits a string into an array.


Syntax
str_split(string,length) 


Example:
<?php

$string="123";
$arr=str_split($string);
print_r($arr);


?>
Output: Array ( [0] => 1 [1] => 2 [2] => 3 )