Search
 
SCRIPT & CODE EXAMPLE
 

PHP

php get first character of string

$firstStringCharacter = substr("hello", 0, 1);
Comment

php get first word of string

$value = "Test me more";
echo strtok($value, " "); // Test
Comment

php get first character of each word

if(!function_exists('get_avatar')){
    function get_avatar($str){
        $acronym;
        $word;
        $words = preg_split("/(s|-|.)/", $str);
        foreach($words as $w) {
            $acronym .= substr($w,0,1);
        }
        $word = $word . $acronym ;
        return $word;
    }
}
Comment

PREVIOUS NEXT
Code Example
Php :: laravel read csv file 
Php :: php password verify 
Php :: count with condition laravel 
Php :: laravel livewire-datatable delete column pop up issue 
Php :: sub menu for post type in wordpress 
Php :: php typeof 
Php :: laravel passport vue 401 Unauthorized 
Php :: wc php if is product category page 
Php :: laravel mail send to multiple recipients 
Php :: php order filename 
Php :: excel date format in php 
Php :: php check if parameter exists in url 
Php :: wp order archive page post by title 
Php :: upload video in laravel 
Php :: autoload file in laravel 
Php :: custom autoload without composer php psr4 
Php :: copy php array to another 
Php :: eloquent where comparing two columns 
Php :: laravel migrations rename table 
Php :: php merge array with same value 
Php :: german locale php 
Php :: laravel get route parameters in blade 
Php :: how to set up the laravel ssh keygen 
Php :: php bulk insert mysql 
Php :: last item coma replace and php 
Php :: laravel list of models 
Php :: php undefined index meaNING 
Php :: laravel chunk 
Php :: refresh laravel model 
Php :: get date to current week last or first day dates 
ADD CONTENT
Topic
Content
Source link
Name
2+9 =