Question about The PHP Group PHP

1 Answer

PHP Array Question

I'm new to PHP my question is how do I create an array with PHP?

What are the uses of an array?

Appreciate the help.


Posted by on

1 Answer

  • Level 2:

    An expert who has achieved level 2 by getting 100 points

    MVP:

    An expert that gotĀ 5 achievements.

    Governor:

    An expert whose answer gotĀ voted for 20 times.

    Hot-Shot:

    An expert who has answered 20 questions.

  • Expert
  • 50 Answers

<?php
$color = array("red", "blue", "yellow");
foreach($color as $key => $value) {
echo $key . " " . $value . "<br>";
}
?>

More info: http://www.phphelps.com/7_Creating_and_looping_array_in_PHP.shtml

Posted on Sep 10, 2008

Add Your Answer

Uploading: 0%

my-video-file.mp4

Complete. Click "Add" to insert your video. Add

×

Loading...
Loading...

Related Questions:

1 Answer

Write a pseudocode declaration for a string array initialized with the following strings einstein newton


the nice thing about pseudocode is that there's many ways to do it
E.g 1;
String str = new Array["einstein',"newton"];
E.g 2;
myStringArray = new Array{'einstein','newton'}

BOTH of the above are correct, because they are pseudocode

Oct 19, 2014 | Compilers & Programming Tools

1 Answer

Declare 2 arrays with 5 as index value of each. the user will input values to the first array(user-defined). Transfer value of the first array to the second array.Get the sum of the second...


You could do this by creating two arrays as such:
int firstArray[5]; int secondArray[5]
and then the sum variable:
int sum = 0;
then you could do a for loop to find the sum of the second array:

Feb 22, 2011 | Microsoft Visual C++ Professional Edition...

1 Answer

How to form an array in visual basics(Express)


samples of arrays in vb.net
1)
dim array(3) as integer

array(0)=1
array(1)=2
array(2)=3
array(3)=4

2) dim array() as integer

array=new integer(){1,2,3,4}

3) for two dimensional arrays add comma separation to the size

May 28, 2010 | Microsoft Visual Basic Enterprise Edition...

1 Answer

How to store in an array the records in a listview


create form1 with one list box and form2 with text boxes and command button.
Go to project >project properties>start object will be form2..
Here i takenexamble of two textboxes..code is below
Private Sub Command1_Click()
Form1.List1.AddItem Text1.Text, 0
Form1.List1.AddItem Text2.Text, 1
Form1.Show
End Sub


hope this will help you...Thank you,....

Nov 11, 2009 | Microsoft Visual Basic Professional...

2 Answers

C++ poker program


Hi.

I suggest creating an Array of Cards (cardOne,cardTwo,etc. to five)

If you can enter them in one at a time, after declaring the array, assign the values to the array.

cin < cardOne; (Psuedo code by the way, hope you don't mind)

Afterwards, you'll have an array with 5 cards.

Declare what full houses, flushes, etc would require.
Use an if statement (If you don't mind lots of code) to compare the entered Array against possible hands.

I didn't necessarily give you any specific C++ code. However, if you Google C++ user input, you should find plenty of commands that may help you.

Good Luck

(And not sure about Linear search to be honest, you can use a Linear search, but if you did it the way I explained, you just have to compare hand to a series of conditionals.)


Sep 23, 2009 | Compilers & Programming Tools

1 Answer

Borland C array size limit


Hi , if you look at some of the postings you find the answer

http://bytes.com/groups/c/530395-array-size-too-large

Regards

Jul 26, 2009 | Compilers & Programming Tools

1 Answer

Memory limit in Borland C


you might be using integer value
try using float it might work
vote please

Jul 25, 2009 | Compilers & Programming Tools

1 Answer

I am java beginner and I want a help in writing a java program to calculate the variance for an array of numbers


the best thing to do here is to separate the steps for calculating the variance into different functions. To compute the variance the first thing to do is to compute the mean or the average of the numbers in the array. so your first function will loop through each of the numbers and divide it by the length of your array. the output is the returned. The next thing to do is create another function for the variance. loop through each of the numbers again and subtract to each number the mean. square the value then add to the previous. so that means you have another variable that starts from zero and just adds the answer. after that divide it by the length of the array again and what you are going to get is the value for the variance.

May 13, 2009 | Compilers & Programming Tools

1 Answer

Php assigning value to variables and posting result, how can i assign a value to variable that will add the score evertytime the answer in my trivia page is correct, how can i make a formula for total...


You can use a session variable.
First use session_start().
Then you can crate a session variable by simply setting the appropriate member of the $_SESSION or $HTTP_SESSION_VARS (PHP < 4.1.0) array
Example.

session_start();

$_SESSION["number"] = 10 ;

echo $_SESSION["number"];

You can call it whenerver you want.
remmember to start session on all the pages where you use the variable.

Mar 17, 2009 | The PHP Group PHP

Not finding what you are looking for?
The PHP Group PHP Logo

Related Topics:

290 people viewed this question

Ask a Question

Usually answered in minutes!

Top The PHP Group Compilers & Programming Tools Experts

Robin Hill
Robin Hill

Level 3 Expert

1251 Answers

Mike

Level 3 Expert

4331 Answers

Mishan Kasiparsad

Level 2 Expert

142 Answers

Are you a The PHP Group Compiler and Programming Tool Expert? Answer questions, earn points and help others

Answer questions

Manuals & User Guides

Loading...