• 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

renameColumn migration fails for existing column with columns does not exist error

Redirect to previous page with php

Chunk and transpose a flat array into rows with a specific number of columns

if statement inside concatenation

Unable to run composer install

PHPUnit (Phar) Fatal Error Only When Test Fails

PHP if in_array() how to get the key as well?

how to hide previous markers when new markers added in google map javascript api

Center point of multiple gps coordinates with php

How to change 'users' auth table and use another instead Laravel

Populate Dynamic Dropdowns List in Codeigniter

How to downgrade or install a specific version of Composer?

Explain how this array transposing and flattening function works

Can't remotely connect to MySQL error (13) with PHP script, connecting through CLI works

Using Associative arrays

About Contact Privacy policy Terms and conditions