Will it make any difference or impact on my result, if I use substr()
instead of mb_substr()
function?
As my server does not have support for mb_ functions, I have to replace it with substr()
The SUBSTR function acts on a character string expression or a bit string expression. The type of the result is a VARCHAR in the first case and VARCHAR FOR BIT DATA in the second case. The length of the result is the maximum length of the source type.
The substr() is a built-in function in PHP that is used to extract a part of string. Parameters: The substr() function allows 3 parameters or arguments out of which two are mandatory and one is optional. start_position: This refers to the position of the original string from where the part needs to be extracted.
You can use the PHP strpos() function to check whether a string contains a specific word or not. The strpos() function returns the position of the first occurrence of a substring in a string. If the substring is not found it returns false .
If you have utf-8 encoding use mb_substr
Example :
echo substr("hi mémé", 0 , 5); // will print hi m� echo mb_substr("hi mémé", 0 , 5); // will print hi mé
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With