PHP current not accessing first (and only) array value

I have this data structure below, which is a print_r of $_GET:

 Array (
     [url] => search/
     [q] => shirt
     [view_all] => 
     [price_float_GBP] => Array
         (
             [0] => 107
         )
 )

Why does $_GET['price_float_GBP'][0] work but current($_GET['price_float_GBP']) doesn't?

Sorry if this is a newbie question but I don't quite see it.

Answers


According to the manual it's possible the pointer to be beyond the end of the elements list. This can easily happen if you use foreach on that array.

Cheers.


Need Your Help

Prefered way to handle Java exceptions in ServletContextListener

java servlets java-ee

For servlet lifecycle stuff, what do you guys recommend doing in response to an exception...

EntityException in MVC4

asp.net-mvc entity-framework asp.net-mvc-4 entity-framework-6

I am new to MVC and i am having a problem. I have one table named tblEmployee , model Employee. Controller EmployeeController. i am having EntityException in my EmployeeController controller.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.