php - divide data with a character from value database -


i have data database, :

$data = "abcdefghi"; 

i want divide data each of 3 characters, , added character newline. confused did count characters split. know use modulo ( % 3), if print :

abc  def  ghi 

i not know syntax should used. can me?

$data = "abcdefghi"; $newdata = implode("\n", str_split($data, 3)); var_dump($newdata); 

Comments

Popular posts from this blog

jQuery Mobile app not scrolling in Firefox -

c++ - How to add Crypto++ library to Qt project -

php array slice every 2th rule -