To match only the beginning of the string in your $salad array, apply the array_filter method.
$search = array_filter($salad, function($el) use ($Object) {
return ( strpos($el[0], $Object) !== FALSE );
});
Here we loop through all elements in the @salad and put them to the test wether or not the first part equals the $Object string.
So your code would be
$veggies = array("Potato", "Cucumber", "Carrot", "Orange", "Green Beans", "Onion");
$fruits = array("Apple", "Banana", "Orange", "Pineapple", "Grapes", "Watermelon");
$salad = array_merge ($veggies, $fruits);
$Object = 'C';
$search = array_filter($salad, function($el) use ($Object) {
return ( strpos($el[0], $Object) !== FALSE );
});
print_r($search);
With a result of
Array
(
[1] => Cucumber
[2] => Carrot
)