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 135 views
1 answer 132 views
1 answer 123 views
1 answer 120 views
1 answer 133 views
1 answer 138 views
2 answers 207 views
...