₦airaland Forum

Welcome, Guest: RegisterLoginWith GoogleTrendingRecentNew

Stats: 3,325,041 members, 8,420,023 topics. Date: Thursday, 04 June 2026 at 09:44 AM

Toggle theme

I Need The Help Of A Coder - Webmasters - Nairaland

Nairaland ForumScience/TechnologyWebmastersI Need The Help Of A Coder (654 Views)

1 Reply

I Need The Help Of A Coder by deco2come(op): 10:26am On Feb 03, 2011
I want to create two functions where by the first function will be the key and the second function will be the value in my array. I have tried doing that but haven't succeed. Can someone help me out please?




<?php

         function please(){
               (for $y=0;$y<=10;$y++){
                      $result = $y*$y;
                       
                      echo "The square root of ".$y." is ".$result.;

              }

}


function answer(){
               (for $p=0;$p<=10;$p++){
                      $result = $p*$p;
                       
                      echo "The square root of ".$p." is ".$result.;

              }

}
$one = please();
$two = answer();

$myarray = array(  foreach( $one as $two));
   
echo $myarray;
?>

Re: I Need The Help Of A Coder by worldsearc(m): 6:12pm On Feb 03, 2011
I think you have not explain very well what you want these functions to process. A single function can provide the two values you want. Do give a more explicit detail and I will try to help with the code.
Re: I Need The Help Of A Coder by sweetpawn1: 1:26am On Feb 04, 2011
NO MY DEAR, IT WILL NOT RUN. THERE ARE A NUMBER OF THINGS THAT YOU HAVE GOT WRONG!

FIRST LETS GO TO YOUR FUNCTION.

function answer(){
               (for $p=0;$p<=10;$p++){
                      $result = $p*$p;
                       
                      echo "The square root of ".$p." is ".$result;

              }


I GUESS YOU WANT THE VALUES TO ENTER AN ARRAY CALLED TWO, YOU DO THIS:

function answer(){
               (for $p=0;$p<=10;$p++){
                      $result = $p*$p;
                       $two[$p]=$result;
                      echo "The square root of ".$p." is ".$result;

              }


AND LIKEWISE FOR THE PLEASE FUNCTION,
I GUESS YOU WANT THE VALUES TO ENTER AN ARRAY CALLED ONE, YOU DO THIS:
 function please(){
               (for $y=0;$y<=10;$y++){
                      $result = $y*$y;
                      $one[$y]=$result;
                      echo "The square root of ".$y." is ".$result;

              }


NOW THIS IS WRONG:

$one = please();
$two = answer();


THE FUNCTIONS PLEASE AND ANSWER CANNOT RETURN ANYTHING BECAUSE YOU HAVE NOT PLACED THE RETURN FUNCTION IN THEM. . . GET YOURSELF UP TO SPEED ON HOW TO USE FUNCTIONS BY CHECKING THIS SITE OUT: http://www.w3schools.com/PHP/php_functions.asp

NOW TO ECHO YOUR RESULTS YOU DO THIS. . .
 function please(){
               (for $y=0;$y<=10;$y++){
                     
                      echo $one[$y] . " ".$two[$y];

              }



TRY THAT AND GIVE FEED BACK!
smiley
1 Reply

Help With My Blog! You Will Be Nicely Rewarded After The HelpGet A Hyip Site Of Your Own Gold Coder Script For Sale234

Website Traffic Made So EasyJerseysThe List And Directory Of Wordpress Plugins