-1

I have the array in PHP 7:

Array ( [0] => 'Param1' [1] => "Value1" )

How can I get 'Param1' and "Value1" values?

Thank you in advance.

1
  • 1
    $arr[0] for Param1 and $arr[1] for Value1 Commented May 17, 2017 at 13:52

2 Answers 2

3

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;
Sign up to request clarification or add additional context in comments.

Comments

0

If your array's name is array, then:

echo $array[0]; //Param1
echo $array[1]; //Value1

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.