str_split() function will breaks a string into an array.
This will return an array of string. it also depends on the length parameter value if,
<?php $strExample = "Hi from tutorialmines."; print_r(str_split($strExample)); ?>
In above example ,We have a string “Hi from tutorialmines.”. Now this function will breaks the string into array of length 1. Output of above code in the browser is as below:
<?php $strExample = "Hi from tutorialmines."; print_r(str_split ($strExample,4)); ?>
In above example ,We have a string “Hi from tutorialmines.”. Now this function will breaks the string into array of length 4. Output of above code in the browser is as below:
<?php $strExample = "Hi from tutorialmines."; print_r(str_split($strExample,30)); ?>
In above example ,We have a string “Hi from tutorialmines.”. Now this function will breaks the string into array of length 30. As length 30 is greater than the length of string. So, only one array element will be returned. Output of above code in the browser is as below:
Array ( [0] => Hi from tutorialmines. )
<?php $strExample = "Hi from tutorialmines."; var_dump(str_split($strExample,-1)); //length is set with negative number. echo "<br/>"; $strExample = "Hi from tutorialmines."; var_dump(str_split($strExample,0)); //length is set with zero 0. ?>
In above example ,We have a string “Hi from tutorialmines.”. Now this function will breaks the string into array of length -1 or 0. But this will retuen false value, as it support values greater than or equal to 1. Output of above code in the browser is as below:
App usage is growing steadily without showing any signs of slowing down. Hence, it is no surprise that mobile applications…
As the world has grown more digital, businesses have adapted themselves. An effectual adaptation includes online advertising. Offline advertising styles…
Step into a world where apps dance to the user's tune. Picture Instagram, a photo-sharing sensation that swept the globe.…
COVID-19 has led to a digitalization of lifestyle. As patients are taking their mental and physical health more seriously, healthcare…
Introduction WordPress, an immensely popular content management system (CMS), powers over 40% of the internet. What makes WordPress even more…
For moving companies trying to capture their market share amidst stiff competition, a tip or two about what they can…