PHP Explode Every Character into Array Example
Hi,
This post will give you example of php explode every character into array. In this article, we will implement a php explode all characters. you will learn explode all characters php. you can see how to explode all character in php using str_split().
Few days ago i was working on my laravel app and i need to explode all characters into array, i know php has explode function but it not works with this requirement. so i research and found str_split() function where it gives you explode all characters into array.
So, let's see bellow very simple example here:
Example:
<?php
$name = "Hardik Savani";
$arr = str_split($name);
print_r($arr);
?>
Output:
Array
(
[0] => H
[1] => a
[2] => r
[3] => d
[4] => i
[5] => k
[6] =>
[7] => S
[8] => a
[9] => v
[10] => a
[11] => n
[12] => i
)
i hope it can help you...
Hardik Savani
I'm a full-stack developer, entrepreneur and owner of ItSolutionstuff.com. I live in India and I love to write tutorials and tips that can help to other artisan. I am a big fan of PHP, Laravel, Angular, Vue, Node, Javascript, JQuery, Codeigniter and Bootstrap from the early stage. I believe in Hardworking and Consistency.
We are Recommending you
- How to Remove Last Element from Array in PHP?
- How to Remove First Element from Array in PHP?
- How to Remove Specific Value from Array in JQuery?
- How to Remove Specific Element by Value from Array in PHP?
- How to Remove undefined Value from Array in JQuery?
- How to Get Maximum Key Value of Array in PHP?
- How to Remove Empty Values from Array in PHP?
- How to Add Prefix in Each Key of PHP Array?
- How to Get Minimum Key Value of Array in PHP?
- How to Remove Null Values from Array in PHP?