• Categories
    • PHP
    • phpMyAdmin
    • PHPMailer
    • FFMpeg
    • PHPEXcel
    • PHPDoc
    • PHPUnit
    • CakePHP
    • CakePHP 2.0
    • Cake PHP 2.1
    • CakePHP Model
    • Facebook PHP SDK
    • composer-php
    • PHP 7
    • PHP GD
    All Categories
  • About

Cut an arabic string

php


PHP Snippet 1:

mb_internal_encoding('UTF-8');

PHP Snippet 2:

return '...'.mb_substr($str, 0, $limit - 3, "UTF-8"); // UTF-8 is optional

PHP Snippet 3:

 public static function shorten_arabic_text($text, $lenght)
        {
            mb_internal_encoding('UTF-8');
            $out = mb_strlen($text) > $lenght ? mb_substr($text, 0, $lenght) . " ..." : $text;
            return $out;
        }

Related Snippets

Show rotation of tweets using current day of month

How to install LDAP in Docker php-fpm alpine

Dropdown with current value from Mysql

PDOException: PDO::__construct(): php_network_getaddresses: getaddrinfo failed: no such host known

Symfony run hint kernel.secret parameter not found

How to get monthly wise data in laravel

jwt decode throws Invalid argument supplied for foreach() on php-jwt and codeignitor 4

XAMPP/SQLSRV: Unable to find Sqlsrv in PHPINFO(); - errors coming from connection

CodeIgniter force_download is not working

Laravel SQL query midnight time not showing

Laravel PackageManifest.php: Undefined index: name

PHP how to detect if running on arm64 cpu?

Create a zip file and download it

Pagekite error: FAIL: localhost:8080 is down

Dropzone: Submit both form data and dropzone at once

About Contact Privacy policy Terms and conditions