• 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

Navigation idle on content download

Star rating with half star support

Transform array, set each array element with parent key php

Check if user online laravel

How to get Laravel's CSRF Token from Another Website?

Having issue with matching rows in the database using PDO

PHP Get value from JSON [duplicate]

Symfony - "framework.test" config is not set to true

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

Malformed MIME header error in Symfony 5.3

How to debug in WooCommerce 3+

Laravel eloquent update record without loading from database

Hi, I am making a contact form thingy, and my php isn't working any reason why?

array_key_exists(): The first argument should be either a string or an integer

What is my SQL missing?

About Contact Privacy policy Terms and conditions