Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Determine foreach
We are using the foreach($array as $eachline) function in an array.

No.    Value.
[a] => apple
[b] => banana
[am] => monkey

How do I determine the No.varabele of the array within the foreach
function?

Mindy



Report this thread to moderator Post Follow-up to this message
Old Post
Mindy Geac
04-18-05 01:55 PM


Re: Determine foreach
First step look in php manual, available for downloand from
http://www.php.net/

foreach ($yourarray as $key => $value){

echo $key .";".$value."/n"

}

the $key is the key

Hello, Mindy!
You wrote  on Mon, 18 Apr 2005 13:07:16 +0200:

MG> No.    Value.
MG>  [a] => apple
MG>  [b] => banana
MG>  [am] => monkey

MG>  How do I determine the No.varabele of the array within the foreach
MG> function?



Report this thread to moderator Post Follow-up to this message
Old Post
srobertson
04-18-05 01:55 PM


Re: Determine foreach
Mindy Geac wrote:
> We are using the foreach($array as $eachline) function in an array.
>
> No.    Value.
>  [a] => apple
>  [b] => banana
>  [am] => monkey
>
>  How do I determine the No.varabele of the array within the foreach
> function?
>
> Mindy
>
>

<?
foreach($array AS $key => $value) {

echo 'My key is:' . $key . ' and my value is: ' . $value;

}
?>

--
___|   ___|  _ \ _ _|  _ \__ __| __ \  |   | __ \  ____|
\___ \  |     |   |  |  |   |  |   |   | |   | |   | __|
| |     __ <   |  ___/   |   |   | |   | |   | |
_____/ \____|_| \_\___|_|     _|  ____/ \___/ ____/ _____|
Computers will never take the place of books. You can't stand on a
floppy disk to reach a high shelf.
I thought 'Deep Throat' was a movie about a giraffe :/



Report this thread to moderator Post Follow-up to this message
Old Post
Scriptdude
04-18-05 01:55 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

PHP Language archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 07:19 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.