• 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

Declaration of OMDb::query(string $statement) must be compatible with PDO::query

WHM Enabling mod_rewrite

Ajax GET request fails in laravel 8

advanced custom fields wordpress custom class

How to convert a carbon into string, to take the date only?

How to get variable from JavaScript to PHP [duplicate]

Nginx disallowing execution of PHP in uploads directory with Magento

How to programmatically find public properties of a class from inside one of it's methods

Nginx RTMP not recording

Group data in a multidimensional array based on two columns

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

args[max_input] woocommerce if statement confused

Show Custom Data in Woocommerce Order Details Admin Area

Laravel UUID generation

Fatal error: Uncaught Error: Call to undefined method mysqli_stmt::fetch_assoc() [duplicate]

About Contact Privacy policy Terms and conditions