Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6121459
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T15:47:11+00:00 2026-05-23T15:47:11+00:00

I understand I can define a function like this: <?php function say_hello() { echo

  • 0

I understand I can define a function like this:

<?php 
    function say_hello() {
        echo "hello world!";
    }

    say_hello();
?>

…and then reuse this function elsewhere as many times as I need by just calling the function by name.

What I don’t understand is “passing data to arguments within the function”. I’m confused what’s meant by within.

From one of the lessons I’ve been studying, I have this function:

<?php 
   function say_helloTWO( $word ) {
       echo " {$word} hello world a second time ";
   }

   say_helloTWO( "my name is mike");
?>

This prints on screen

my name is mike hello world a second time

When I test the function with the argument "my name is mike", it prints to screen, but I don’t understand how this works. The variable $word wasn’t declared anywhere, so, if I take out the "$word" from the echo, then only "hello world a second time” shows without the my name is mike.

This leads me to believe that somewhere within this block of code, $word was defined, is that right?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T15:47:12+00:00Added an answer on May 23, 2026 at 3:47 pm

    In your second function $word is being declared in the function definition function say_helloTWO( $word ).

    So the function is expecting 1 parameter, which will be assigned to the variable $word for use within that function.

    So when you call say_helloTWO( "my name is mike"); you are passing 1 parameter (“my name is mike”) to the function say_helloTWO. This 1 parameter gets assigned to the 1st variable in the function definition, and is therefore available within the function as $word.

    Make sense?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I understand I can apply several options to the ServiceContract (like Name , Namespace
Any existing Flash SWF compilers that can understand directives like #IF #ENDIF , etc?
I hope I can explain this well enough so that you can understand the
I just define a root path as a constant like this define(ROOT_PATH, dirname(__FILE__)); so,
I would like to define the following function in Objective-C. I have provided pseudo-code
I dont understand why i am getting this on my php site Fatal error:
I can't understand how to define default values for functions in my library. Default
i need to create an url like this: www.example.com/index.php/scheda/name-surname-id.html so i create the Scheda
I can understand that imposing a minimum length on passwords makes a lot of
I can understand the use for one level of namespaces. But 3 levels of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.