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

  • SEARCH
  • Home
  • 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 8200681
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T06:32:01+00:00 2026-06-07T06:32:01+00:00

If I use function_exists as following: if ( ! function_exists( ‘get_value’ ) ) :

  • 0

If I use function_exists as following:

if ( ! function_exists( 'get_value' ) ) :
    function get_value( $field ) {
    ..
    return $value;
}
endif;

Now, when I call the function in the same file before the above function, it will give fatal error:

Fatal error: Call to undefined function get_value() ...

But, if i call it after the above function, it will return the value without any error.

Now, if I remove the function_exists condition, ie:

function get_value( $field ) {
    ..
    return $value;
}

Then it will work if i call this function before or after in the same document. Why is this so?

  • 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-06-07T06:32:02+00:00Added an answer on June 7, 2026 at 6:32 am

    If you define the function directly without the if statement, it will be created while parsing / compiling the code and as a result it is available in the entire document.

    If you put it inside the if, it will be created when executing the if statement and so it is not possible to use it before your definition. At this point, everything written above the if statement is executed already.

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

Sidebar

Related Questions

I use a function that sends emails to some users. I use the following
I have the following function: private static void prettyPrint(Document doc, File destFile) { TransformerFactory
Is it possible to use a regular expression with the php function array_key_exists() ?
Does such function exist? I created my own but would like to use an
I use function below to check connection to WiFi hotspot point: public boolean IsWiFiConnected(){
How do I use function arguments declared like void f(double) { /**/ } if
I think it would be easier to use function pointers if I created a
PHP5.1.6 has no json_encode(), so I wanted to use function found on json_encode documentation
I use this function for transforming URLs to images on output. function InsertLink(T){ var
I use DATEDIFF function to filter records added this week only: DATEDIFF(week, DateCreated, GETDATE())

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.