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 235 views
1 answer 226 views
1 answer 206 views
1 answer 212 views
1 answer 218 views
1 answer 225 views
2 answers 331 views
...