Je cherche un moyen de tirer les 100 premiers caractères d'une variable de chaîne pour mettre dans une autre variable pour l'impression.Comment tirer les 100 premiers caractères d'une chaîne en PHP
Y at-il une fonction qui peut le faire facilement?
Par exemple:
$string1 = "I am looking for a way to pull the first 100 characters from a string variable to put in another variable for printing.";
$string2 = 100charfunction($string1);
print $string2
Pour obtenir:
I am looking for a way to pull the first 100 characters from a string vari
il y a un problème sur le retour du texte arabe, car ils sont des mots avec des lettres combinées si le second paramètre (100) ne sont pas à la fin des mots arabes sur le dernier tout en comptant 100, il renvoie null . pour cela, nous allons utiliser (mb_substr ($ big, 0,100) – SAR