• 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

How to create a individual template for page or post in custom plugin?

Installing Composer - Internal Error

shell errors running php exec

How to redirect to another page and call a Function there on Angular ng-click

Filter WooCommerce products with post__in and additional meta queries

How to downgrade or install a specific version of Composer?

get folder directory from input type file - PHP

Batch request Google Calendar php API

Alert message after submitting form in PHP

Image upload not working through ajax Laravel

Use same method for inertia response and json response Laravel Jetstream

Change the alert text on add to cart action without selected variation in Woocommerce

How do I remove this delivery notification from here?

Inserting data into SQL Server Db An Invalid direction was specified

Star rating with half star support

About Contact Privacy policy Terms and conditions