Test 1

by PuLLi from 2024-05-11

I am text.

<?php

function wrap_text_with_words(string $text) {
    return preg_replace('/(.{1,80})(\s+|\Z)/', "\\1\n", $text);
}

# Example
$text = "This is a silly example with more than 80 characters. No it isn't, but let's pretend it is for god's sake.";
$wrapped_text = wrap_text_with_words($text);
echo $wrapped_text;

More Text.