phpist

Untitled

Oct 17th, 2019
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1.  
  2. Объясните $st = wordwrap($ourText, $maxlen - strlen($prefix), "\n");
  3. $st = $prefix.str_replace("\n", "\n$prefix", $st);
  4.  
  5.  
  6. <?php ## Использование wordwrap().
  7. function cite($ourText, $maxlen = 60, $prefix = "> ") {
  8. $st = wordwrap($ourText, $maxlen - strlen($prefix), "\n");
  9. $st = $prefix.str_replace("\n", "\n$prefix", $st);
  10. return $st;
  11. }
  12. echo "<pre>";
  13. echo cite("The first Matrix I designed was quite naturally
  14. perfect, it was a work of art - flawless, sublime. A triumph
  15. equalled only by its monumental failure. The inevitability
  16. of its doom is apparent to me now as a consequence of the
  17. imperfection inherent in every human being. Thus, I
  18. redesigned it based on your history to more accurately reflect
  19. the varying grotesqueries of your nature. However, I was again
  20. frustrated by failure.", 20);
  21. echo "</pre>";
  22. ?>
Advertisement
Add Comment
Please, Sign In to add comment