How do i get first word of a string in var1 and rest in 2nd var.
My Requirement:
$strInput = "SSCL BAl 101";
$strFirst = ...;
$strRest = ...;
My Output:
strFirst = SSCL
strRest = BAL 101
My Current Solution:
list($strFirst,) = explode(" ", $strInput );
$strRest = trim(str_replace($strFirst, '', $strInput ));
Is there any other simple way too?
Output
CodePad.