I may have a brain cloud, but i am completely stumped by this.
I have an array
$A = array ( 1=>'Brand 1', 2=>'Brand 2', 3=>'Brand 3');
As I am stepping through my results, I want to check a record in a result set against array $A
so:
$needle = 'Brand 2';
if (in_array($needle, $A)
{
$str = 'display this';
}
else
{
$str = 'something else';
}
what I want to do is have:
$str = 'display this'. / add the KEY of $A to the end of this string. (so i want to add the key of 2 to the end of this) / ;
Is this possible?