• 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

PHP password_verify

Artisan, creating tables in database

Using if(isset($_POST['submit'])) to not display echo when script is open is not working

phpMyAdmin ERROR: mysqli_real_connect(): (HY000/1045): Access denied for user 'pma'@'localhost' (using password: NO)

Malformed MIME header error in Symfony 5.3

How can I access an array/object?

PHP Imap , php 7.4.3 on mac osx catalina

How to add a custom field to all Woocommerce attribute terms using add_action

Send same name multiple checkbox values via ajax

Uploading video to Youtube using Youtube Data API V3 and Google API Client PHP -- getting 401 (unauthorized) message

Remove "estimated for {country}" text after tax amount in Woocommerce checkout page

PHP Warning: Module already loaded in Unknown on line 0

generate an Excel file using PHP

Not able to override collapsible.js in magento 2

laravel sanctum Route [login] not defined

About Contact Privacy policy Terms and conditions