I've been researching different ways to get an array using JInput.
According to http://docs.joomla.org/Retrieving_request_data_using_JInput there are 2 methods that I can use.
Method1
$jinput = JFactory::getApplication()->input; $jinput->get('nameOfArray',array(),'ARRAY');
Method2
$jinput = JFactory::getApplication()->input; $jinput->getArray('nameOfArray',array());
Note: nameOfArray
is the name of the array I want to access in the $_GET superglobal array.
Method1 works, but Method2 gives the following error:
Catchable fatal error: Argument 1 passed to JInput::getArray() must be of the type array, string given, called in test.php
My question is: What’s the difference between these two methods?
- The array used in both examples is the same
- I'm using Joomla 2.5.x
- The array is a multidimensional array.