Answers for "php get first two words of string"

PHP
0

get only the first two word from a string php

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

php get first two paragraphs

$str = "<p>This is one</p><p>This is two</p><p>This is three</p>";
$pattern="/(<p[^>]*>(.*)</p>){2}/isU";
preg_match($pattern,$str,$matches);
echo htmlentities($matches[0]);
Posted by: Guest on August-13-2021

Code answers related to "php get first two words of string"

Browse Popular Code Answers by Language