Jump to content

Exit() Does Not Work


Recommended Posts

I am using the exit() command in one of my scripts and it is being ignored. Any idea why this would be?

 

The exit() is within a function which is attempting to grab a value out of an array as follows:

 

>
function get_setup_fee($prod_id, $M_PRODS, $M_SETUP ) {

//figure out the location of the product_id in the array and get it's key
$keyz = array_search($prod_id,$M_PRODS);

// now we have the key we the use the same key against the setup fees to find the matching one
$setup_fee = $M_SETUP[$keyz];

echo "The keyz is: " . $keyz;
echo "The prod_id is: " . $prod_id;
echo "M_PRODS is: " . $M_PRODS;
echo "The setup_fee is: " . $setup_fee;
exit();

return $setup_fee;
}

 

The $setup_fee value being returned is wrong so I want to echo the values to the screen so I can figure out the issue with the code. However the script continues to run so I can't see what the values are. Any idea why this would be?

 

I read on another forum that in shared hosting it may be "something with either safe_mode being enabled, output buffering being enabled, or error_reporting being enabled.". Anyone know anything about that?

 

Thanks for the help!

 

:)

 

Hi! I am the guy behind NetChimp, a web design company.

 

NetChimp offers Web Design York and Web Design Aberdeen plus SEO York and are known as a good Small Business Web Designer with a website packed with Good Web Design Examples.

Edited by kcraighead
Link to post
Share on other sites

You could also try changing all your 'echo' statements to error_log() function calls. Like so:

 

>
error_log('The keyz is:' . $keyz);
error_log('The prod_id is: ' . $prod_id);
error_log('M_PRODS is: ' . $M_PRODS);
error_log('The setup_fee is: ' . $setup_fee);

 

Then check your php error log to see what has been written to it.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...