How to split a string into fixed length chunks in PHP

1 Answer

0 votes
$str = "php java c++ c python c#";

$length = 5;

$chunks = chunk_split($str, $length);

echo $chunks;




/*
run:

php j
ava c
++ c 
pytho
n c#

*/

 



answered Oct 6, 2022 by avibootz

Related questions

1 answer 237 views
1 answer 229 views
1 answer 209 views
1 answer 216 views
1 answer 223 views
1 answer 227 views
2 answers 334 views
...