Site Owners Forums - Webmaster Forums

Site Owners Forums - Webmaster Forums (http://siteownersforums.com/index.php)
-   PHP / mySQL (http://siteownersforums.com/forumdisplay.php?f=10)
-   -   Get First Character of String in PHP (http://siteownersforums.com/showthread.php?t=190682)

michalsemen 03-10-2017 07:10 AM

Get First Character of String in PHP
 
There are three ways to get first character of a string in PHP.

1: By using array index position $res = $currency_value[0]; where $currency_value is holding string.

2: By using built-in PHP function substr() i.e $res = substr($currency_value,0,1);

3: By using built-in PHP function mb_substr() i.e $res = mb_substr($currency_value,0,1)

mb_substr() function is used when programmer is dealing with multibyte UTF8 characters.

Find a video here in which it has been explained clearly that how you can get first character of a string in PHP.

riyadh 03-13-2017 02:24 PM

good job ! thanks


All times are GMT -7. The time now is 09:45 PM.


Powered by vBulletin Copyright © 2020 vBulletin Solutions, Inc.