-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.

Sr. X
  • 1
  • 1
  • 1

2 Answers2

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;
treyBake
  • 6,440
  • 6
  • 26
  • 57
0

If your array's name is array, then:

echo $array[0]; //Param1
echo $array[1]; //Value1
Adam Benedek
  • 592
  • 4
  • 17