Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,152,366 members, 7,815,783 topics. Date: Thursday, 02 May 2024 at 06:15 PM

PHP Guys Please Help Me Solve This Problem - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / PHP Guys Please Help Me Solve This Problem (1664 Views)

Who Can Solve This Problem Using Java / How Do I Solve This Problem On Html And Css? / Somebody Should Help Me To Solve This Problem (2) (3) (4)

(1) (Reply) (Go Down)

PHP Guys Please Help Me Solve This Problem by WafiJoe(m): 6:14pm On Jan 31, 2016
So I have been using codecademy lately to study programming. And things have been going fine but now I am stucked. Please PHP guys I need your help to solve this problem.

"Create an array() with the names of your closest family and friends. The more names in your array, the more fun your game will be!

After you've created your list, sort it and randomly select a name from the list.

When you have your winning name, print it to the screen in caps so everyone knows how awesome the winner is.

Functions we'll use here: array(), array_push(), sort(), count(), rand(), and strtoupper(). Play around with some of the other functions you've learned as well."
Re: PHP Guys Please Help Me Solve This Problem by TruthHurts1(m): 6:37pm On Jan 31, 2016
WafiJoe:
So I have been using codecademy lately to study programming. And things have been going fine but now I am stucked. Please PHP guys I need your help to solve this problem.

"Create an array() with the names of your closest family and friends. The more names in your array, the more fun your game will be!

After you've created your list, sort it and randomly select a name from the list.

When you have your winning name, print it to the screen in caps so everyone knows how awesome the winner is.

Functions we'll use here: array(), array_push(), sort(), count(), rand(), and strtoupper(). Play around with some of the other functions you've learned as well."

I've always wanted to know, Is codeacademy free?
Re: PHP Guys Please Help Me Solve This Problem by WafiJoe(m): 6:40pm On Jan 31, 2016
TruthHurts1:


I've always wanted to know, Is codeacademy free?

It has free version and premium version.
Re: PHP Guys Please Help Me Solve This Problem by codemarshal08(m): 6:41pm On Jan 31, 2016
WafiJoe:
So I have been using codecademy lately to study programming. And things have been going fine but now I am stucked.

Bro show some codes and Point Where you are stuck !
Re: PHP Guys Please Help Me Solve This Problem by WafiJoe(m): 6:46pm On Jan 31, 2016
codemarshal08:


Bro show some codes and Point Where you are stuck !

<?php
$fam = array("Steve", "John", "Madu", "Cynthia" );

?>

That is all I got embarassed embarassed embarassed
Re: PHP Guys Please Help Me Solve This Problem by codemarshal08(m): 7:03pm On Jan 31, 2016
WafiJoe:


<?php
$fam = array("Steve", "John", "Madu", "Cynthia" );

?>

That is all I got embarassed embarassed embarassed

Ok. Check this Out. Some PHP gurus here might have a better solution for you.


<?php
$arrayOfNames = array("Emmanuel", "Osas Omon", "Victor ekon", "Abu aliyu" ); // Creates an array of names
array_push($arrayOfNames, "grace owoh" ); // adds "grace owoh" to the end of the array
sort($arrayOfNames); // sort the array
$randomName = $arrayOfNames[rand(0, count($arrayOfNames)-1)]; // rand takes lower and upper limits
echo strtoupper($randomName); // output in uppercase


?>
Re: PHP Guys Please Help Me Solve This Problem by WafiJoe(m): 7:18pm On Jan 31, 2016
codemarshal08:


Ok. Check this Out. Some PHP gurus here might have a better solution for you.


<?php
$arrayOfNames = array("Imafidon Emmanuel", "Osas Omon", "Victor ekon", "Abu aliyu" ); // Creates an array of names
array_push($arrayOfNames, "grace owoh" ); // adds "grace owoh" to the end of the array
sort($arrayOfNames); // sort the array
$randomName = $arrayOfNames[rand(0, count($arrayOfNames)-1)]; // rand takes lower and upper limits
echo strtoupper($randomName); // output in uppercase


?>

Bro it worked like magic. Hope you guys don't mind if I drop in some more problem when I get stucked?
Re: PHP Guys Please Help Me Solve This Problem by codemarshal08(m): 7:22pm On Jan 31, 2016
i will advice you try to solve them yourself first. You won't learn anything if you keep dropping it here.
Feel free to ask for help when you get stuck.
Re: PHP Guys Please Help Me Solve This Problem by WafiJoe(m): 7:25pm On Jan 31, 2016
codemarshal08:
i will advice you try to solve them yourself first. You won't learn anything if you keep dropping it here.
Feel free to ask for help when you get stuck.

Okay, thanks. And for your swift response, thanks again.

(1) (Reply)

Which Website Do You Download Your Ebooks From ? / HELP WITH Erp(enterprise Resource Program) SOLUTION / Mobile Site Programmer Wanted (Immediate Commencement)

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 18
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.