Communities for your favorite technologies. Explore all Collectives
Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work.
Bring the best of human thought and AI automation together at your work. Learn more
Find centralized, trusted content and collaborate around the technologies you use most.
Stack Internal
Knowledge at work
Bring the best of human thought and AI automation together at your work.
I have the array in PHP 7:
Array ( [0] => 'Param1' [1] => "Value1" )
How can I get 'Param1' and "Value1" values?
Thank you in advance.
$arr[0]
$arr[1]
to access array values by key you'd do:
<?php $array = ['product_id' => 100, 'product_name' => 'name']; //basic $firstParam = $array[$keyValue] //e.g. $id = $options['product_id']; //var_dumping the id will return 100;
Add a comment
If your array's name is array, then:
array
echo $array[0]; //Param1 echo $array[1]; //Value1
Start asking to get answers
Find the answer to your question by asking.
Explore related questions
See similar questions with these tags.
$arr[0]for Param1 and$arr[1]for Value1