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 247 views
1 answer 234 views
1 answer 213 views
1 answer 222 views
1 answer 229 views
1 answer 238 views
2 answers 342 views
...