Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

get first word from string php

function getFirstWord($string)
    {
        $arr = explode(' ', trim($string));
        return isset($arr[0]) ? $arr[0] : $string;
    }
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #word #string #php
ADD COMMENT
Topic
Name
4+2 =