Ok, I have to do an assignment for cass. The teacher wants us to use a FOR loop to print out only first three variables stored in an array called $birds. How do I use a FOR loop to print out only those first three? And furthermore, how would I use it to print out a specific value in the array that is not in sequence with the rest?

Member Avatar for nevvermind
<?php

$birdies = array('birdie1', 'birdie2', 'birdie3', 'berdie4', 'berdie5', 'berdie6', 'berdie7');

for ($i = 0; $i < 3; $i++) {
    echo $birdies[$i] . "<br />";
}

how would I use it to print out a specific value in the array that is not in sequence with the rest?

What do you mean?

Ok, I have to do an assignment for cass. The teacher wants us to use a FOR loop to print out only first three variables stored in an array called $birds. How do I use a FOR loop to print out only those first three? And furthermore, how would I use it to print out a specific value in the array that is not in sequence with the rest?

Do your part, man!
You have google and such resources as book. I cannot imagine you cannot get even for loop explanation. That is called laziness. Next time try yourself and when you hit a wall, then ask. We do not do assignments for students

<?php

$birdies = array('birdie1', 'birdie2', 'birdie3', 'berdie4', 'berdie5', 'berdie6', 'berdie7');

for ($i = 0; $i < 3; $i++) {
    echo $birdies[$i] . "<br />";
}

What do you mean?

nevvermind,
don't do assignment for them,
it goes against very purpose of DW, that is to help people and not to cheat professors :)

Member Avatar for diafol

Here here Ev. I hate it when people do the work for some lazy-a*. No wonder we get so many fly-by and gimme-gimme posters. I used to enjoy posting here, now it's turned into Kindergarten. Grumble, grumble...

Member Avatar for nevvermind

Roger that.

Here here Ev. I hate it when people do the work for some lazy-a*. No wonder we get so many fly-by and gimme-gimme posters. I used to enjoy posting here, now it's turned into Kindergarten. Grumble, grumble...

That turns many off, and yes I cannot see a lot of PHP company here. I think Mods have to do something and nail a thread that says If you are lazy enough to escape assignments, don't even register

Wow.... The only reason I did post in the first place, is because I was not understanding what I was getting from the w3school website, nor from the PHP manual site. I had already tried MULTIPLE variations on the for loop with the array, and all of them generated errors. Now, Had I actually understood what I was doing, none of you would have ever seen such a post from me. I am 2 weeks ahead of my class, And I a have not been a member of Daniweb for even THAT long. So 98% of my progress came from the fruits of my OWN research. You were all a last resort. Thank you, for being so condemning and hateful to a new member. I am not going to sit here and cry about it all night. Just thought ya might like to know the facts. Thank you. And have a great day. =D

P.S. No, I am not at you. Cause frankly, it would be a waste of my time to be mad at you. It would distract me from more research. =P

Ok, I have to do an assignment for cass. The teacher wants us to use a FOR loop to print out only first three variables stored in an array called $birds. How do I use a FOR loop to print out only those first three? And furthermore, how would I use it to print out a specific value in the array that is not in sequence with the rest?

Let's be honest and stop yelling :)
Is this quote from someone who have made research? From your post(Independent of whether you have researched or not) shows that you want us to do for you which we cannot. If you really did research there is no reason for such looong rebuttal, Just post your code and errors and we will help you.

As I said before, we help people who Shows effort. You did hid your effort, and you thought we would just know the errors and what you have?

Be fair, and again stop yelling with those Caps

Yes, you are right. I apologize for this. It would have been better had I posted my code and explained from there. I will do better in the future. And I am also sorry for all of the caps. I didn't intend to look like I was yelling, but rather place emphasis on the words.... guess it would have helped if I had used the advanced editor option... Noobs, what can you do with us?

Yes, you are right. I apologize for this. It would have been better had I posted my code and explained from there. I will do better in the future. And I am also sorry for all of the caps. I didn't intend to look like I was yelling, but rather place emphasis on the words.... guess it would have helped if I had used the advanced editor option...

No problem, its ok :)
Caps always mean speak louder(that is emphasis too) ;) just use bold/italic/underline to emphasize something, especially in tense situations where anything can be interpreted int anything else.

Noobs, what can you do with us?

How much did you fell before you moved from crawling to walking? I hope we repeat same exercise in many arena. :icon_lol:

Member Avatar for diafol

Glad that's sorted. We welcome noobs, but need to see evidence of effort (not just "I've tried ..."). Would have hated to add another user to my Ignore List.

.........my Ignore List.

I love that :)

Member Avatar for nevvermind

I got down-voted. The irony...:icon_rolleyes:

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.