CodefyPHP FrameworkCodefyPHP Framework
  • Home
  • Community
    • Forum
    • Github
    • YouTube
  • News
  • Home
  • Community
    • Forum
    • Github
    • YouTube
  • News
home/Knowledge Base/Helpers/truncate_string
Popular Search:installation, codex, mail

truncate_string

32 views 0

Written by Joshua
August 14, 2024

Description

Truncates a string to the given length. It will optionally preserve HTML tags if $isHtml is set to true.

Usage

<?php

use function Qubus\Support\Helpers\truncate_string;

truncate_string(string $string, int $limit, string $continuation = '...', bool $isHtml = false): string;

Parameters

$string (string) (required) The string to truncate.

$limit (int) (required) The number of characters to truncate too.

$continuation (string) (optional) The string to use to denote it was truncated. Default ...

$isHtml (bool) (optional) Whether the string has HTML.

Return Value

(bool) Returns true if true, false otherwise.

Edit on Github

Last Updated on August 14, 2024 by Joshua

Related Articles
  • mail
  • sort_element_callback
  • php_where
  • php_like
  • convert_array_to_object
  • compact_unique_array

Didn't find your answer? Check out the Forum

Leave A Comment Cancel reply

You must be logged in to post a comment.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

  is_false__

compact_unique_array  

  • Copyright 2025 CodefyPHP.com. All Rights Reserved

Popular Search:installation, codex, mail