₦airaland Forum

Welcome, Guest: RegisterLoginWith GoogleTrendingRecentNew

Stats: 3,326,642 members, 8,427,409 topics. Date: Monday, 15 June 2026 at 09:26 PM

Toggle theme

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

Nairaland ForumScience/TechnologyProgrammingPHP Guys Please Help Me Solve This Problem (1820 Views)

1 Reply (Go Down)

PHP Guys Please Help Me Solve This Problem by WafiJoe(op): 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(op): 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(op): 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):
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(op): 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(op): 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

Who Can Solve This Problem Using JavaHow Do I Solve This Problem On Html And Css?Somebody Should Help Me To Solve This Problem234

JS Script Not Working(for_in Loop)♦route Redistributing: CCNA Network Engrs♦Easy To Use Software Allows You To Setup Automated VTU Portal In Less Than 60 Se