• 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

Multiply each value in array using array_map function

Create tags in laravel post publishing

Explode not working properly with dash

insert multiple rows in a saveall in cakephp

how can I set a session variable in Drupal 8 and get it in a php script?

enable Apache http Authorization header

Open a popup box after receiving result from ajax

curl returning 301 error after migrating to https

Laravel Schedule not sending email

Sort a multidimensional array by integer inside of a string value which is two levels down

Read users and passwords from a txt file

Add and update products to session cart in Laravel

Converting alphabet letter to alphabet position in PHP [duplicate]

How can I remove the "Advanced" panel of all blocks in WordPress block editor?

Cross-Origin Resource Sharing (CORS) witth Laravel and Vuejs

About Contact Privacy policy Terms and conditions