Answers for "php get the first section of matching strings"

PHP
1

get first word from string php

function getFirstWord($string)
    {
        $arr = explode(' ', trim($string));
        return isset($arr[0]) ? $arr[0] : $string;
    }
Posted by: Guest on February-26-2021
0

get only the first two word from a string php

$message = preg_split('/[s,]+/', $message, 3)
Posted by: Guest on August-06-2020

Code answers related to "php get the first section of matching strings"

Browse Popular Code Answers by Language