Results 1 to 5 of 5
Thread: PHP Arrays
-
11-17-2002, 03:06 AM #1Web Hosting Master
- Join Date
- Nov 2002
- Posts
- 737
PHP Arrays
I looked at the manual on the php site about it but didn't quite understand what it meant. If some one clould explain it a bit clearer for me as to how to set value in an array and such. Thanks
LipWeb.Net
"Less Lip More Service"
Providing Quality Hosting at Fair Prices
AIM: LipWebNet MSN: daniel[at]lipweb.net [color=red]
-
11-17-2002, 03:22 AM #2Junior Guru Wannabe
- Join Date
- Nov 2002
- Posts
- 74
Edit: Missed the last part --
PHP Code:<?php
$name[] = "Bob";
$name[] = "John";
?>
or you could also set it this way
<?php
$name = array ("Bob","John");
?>
-
11-17-2002, 03:31 AM #3Web Hosting Master
- Join Date
- Nov 2002
- Posts
- 737
now in access it for example if I wanted to compare the value in the array to another value. for example in psuedo code.
Code:<?php $name[] //declaring $name for future use, not sure if possible in php if (data == $name[]) //data represents another value { //do something } else { //do something else }
LipWeb.Net
"Less Lip More Service"
Providing Quality Hosting at Fair Prices
AIM: LipWebNet MSN: daniel[at]lipweb.net [color=red]
-
11-17-2002, 03:49 AM #4Junior Guru Wannabe
- Join Date
- Sep 2001
- Location
- Manila
- Posts
- 71
$A[0]="hello";
$A[1]="<br>";
$A[2]="world";
for($counter=0;$counter<3;$counter++)
{
echo "$A[$counter]";
}
that would give a result of:
hello
world
-
11-17-2002, 03:51 AM #5Web Hosting Master
- Join Date
- Nov 2002
- Posts
- 737
thanks both of you, its very similar to java(if not the same) just wanted to make sure before I started screwing with a friends code to make something to work.
LipWeb.Net
"Less Lip More Service"
Providing Quality Hosting at Fair Prices
AIM: LipWebNet MSN: daniel[at]lipweb.net [color=red]