Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,171,436 members, 7,881,581 topics. Date: Saturday, 06 July 2024 at 12:32 AM

I Need The Help Of A Coder - Webmasters - Nairaland

Nairaland Forum / Science/Technology / Webmasters / I Need The Help Of A Coder (610 Views)

Help With My Blog! You Will Be Nicely Rewarded After The Help / Get A Hyip Site Of Your Own Gold Coder Script For Sale / I Need The Services Of A Hacker! Very Urgent Please (2) (3) (4)

(1) (Reply)

I Need The Help Of A Coder by deco2come: 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)

.com Domain Names @1,300 / Which State Government Website Is The Best? / Are Free Themes Advisable For A Blog?

(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. 10
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.