Need some help exploding this PHP array and assign it a variable to each.
in Splits i have two inputs. a first name and last name.
example.
Chris Moreno. I want to be able to grab that and endpoint and exploding it and pass them into a variable.
(endpoint) api.org/endpoint?filter= Chris Moreno
$splits = explode(' ', $filter);
foreach ( $splits as $key => $literalFilter){}
fName = chris
lName = moreno
Ive tried a could of things but i am not able to do it. has someone ran into this before?
if i do vardump at $splits i get the following;
array(2) {
[0]=>
string(5) "chloe"
[1]=>
string(6) "moreno"
}
$fname = $splits[ 0 ];