user3148518
user3148518

Reputation: 11

php- how to use explode feature by number of character?

I create code for the divide the paragraph of string by " ". but now i want to divide the paragraph or string by number of character.

<?php
$pizaa="this is my line"
$pieces = explode(" ", $pizza);
echo $pieces;
?>

In above code how to divide this line by number of character.not using wordwrap(). only using the explode().

Upvotes: 0

Views: 69

Answers (1)

Nambi
Nambi

Reputation: 12042

use str_split() to explode by number of character.

<?php
$pizaa="this is my line";
$pieces = str_split($pizaa);
var_dump($pieces);
?>

Upvotes: 1

Related Questions