• 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

Match single unknown parameter php (Morse-code Regex)

What's the net::ERR_HTTP2_PROTOCOL_ERROR about?

Composer Script echo

how to identify the web server name of remote host

php echo xml documents with header

Sagepay Error The Vendor failed to provide a RedirectionURL

Laravel dosen't connect with Oracle

How to submit a form when page loads using JavaScript?

getting error while enter Command => php artisan route:list

jQuery Ajax Post with data

How can I make this nested location configuration use the correct path to call a php program?

XAMPP keeps showing Dashboard/Welcome Page instead of the Configuration Page

How to send image,audio or video through the WhatsApp API - PHP

PHP drop down list using array's and foreach (else and for) code

How to execute sql code based on fetch array

About Contact Privacy policy Terms and conditions