473,414 Members | 1,709 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

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
Jul 17 '05 #1
2 1226
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?
Jul 17 '05 #2
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 :/
Jul 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: CJack | last post by:
hi, i have a window form with different controls. i want to loop through all the controls and write the types and lables of each control in a file. I dnt know how to determine the type of a control...
2
by: Chris Fink | last post by:
Using WMI, how do I retrieve the list of running applications on a pc? If you open up task manager and click on the applications tab, I am trying to retrieve the task name and the status. I...
0
by: Stuart Shay | last post by:
Hello All I have a ASP.NET 2.0 checkbox list, the problem is when 0 items are checked I am unable to determine if the list is empty //Determine Checked Roles CheckBoxList ckUserRoleList =...
12
by: garyusenet | last post by:
I want to write a program that lists all folders on my local hard drive in order of size, any ideas for how I might do this? Thankyou, Gary.
2
by: gary.comstock | last post by:
We have setup 4 NT groups - Executive, Manager, Employee and Contractor. The premise is that an Executive has all of the privileges of Itself plus Manager plus Employee plus Contractor while an...
1
by: The ants are driving me crazy | last post by:
Can anyone point me to code samples that can get the permission set for a network drive? I tried the FileInfo and DirectoryInfo classes but they do not seem to list what I need.
2
by: tks423 | last post by:
How can I determine the values of a listbox, both unselected or selected after submitting the form: Code: <select name="sel1" size="10" multiple="multiple"> <? PHP code populates listbox ?>...
9
by: | last post by:
I am interested in scanning web pages for content of interest, and then auto-classifying that content. I have tables of metadata that I can use for the classification, e.g. : "John P. Jones" "Jane...
6
by: John A Grandy | last post by:
InstrumentPropertyEntity string Name InstrumentEntity string Name List<InstrumentPropertyEntityInstrumentProperties For a List<InstrumentEntity, I want to determine the...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.