Jump to content

list() and each()


Howdy_McGee

Recommended Posts

Wasn't quite sure where to post this but here it is.

 

I was reading about arrays and it had briefly mentioned list() and each() but I wasn't quite sure what they did or where I would actually implement them in a real world situation. Can anyone go into more detail of what they actually do/why I would want to use these functions?

 

I read more about them on php.net but it didn't really clear any of my confusions.

 

Thanks!

Link to comment
Share on other sites

list can be used in conjunction with explode quite nicely to place results into seperate variables rather than arrays. or they also work well with recordsets as shown in the php.net page under list()

 

<?php
$mything = "12-06-2011";//english date as I'm from UK

list($day,$month,$year) = explode("-",$mything);

?>

 

way I see it, if you know what they do, and can't find a use for it, you probably don't need it, its not something I use.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.