Logo Luan Morina
PHP Word Wrap Demo
All the
world’s a
stage, and all
the men and
women merely
players. They
have their
exits and their
entrances.

What is word wrap in PHP?

In PHP, the wordwrap() function is used to wrap a string into new lines when it reaches a specific length.

PHP

<?php 
$demo_content = 'All the world’s a stage, and all the men and women merely players. They have their exits and their entrances.';
$demo_wrap = wordwrap($demo_content, 15, "<br/>\n", true);
print $demo_wrap;
?>
   Word wrap