Answers for "how to explode string in php in first space"

PHP
2

php split string at first space

$array = explode(' ', $string, 2);
Posted by: Guest on May-31-2020
0

php explode and get first value

$beforeDot = array_shift(explode('.', $string));
$beforeDot = current(explode(".", $string));

// PHP <= 5.3:
$beforeDot = explode(".", $string);
$beforeDot = $beforeDot[0];
Posted by: Guest on April-17-2021

Browse Popular Code Answers by Language