Link to home
Start Free TrialLog in
Avatar of higijj
higijj

asked on

Goto/label

Is there such a function like goto in PHP

I mean.. instead of calling exit() at many place in my code.. I'd like to send all 'exit()' to a single place where I could do the appropriate action (closing the DB)
Avatar of heddesheimer
heddesheimer

Try die() with a function name as parameter to clean up things:
http://www.php.net/manual/en/function.die.php

See Example 2 for using die with a function as parameter

Marian
Avatar of higijj

ASKER

ok.. but what if I don't want my script to die?
then try another question :-)

You asked in your original question 'I'd like to send all 'exit()' to a single place where I could do the appropriate action (closing the DB)' and that is what I told you.

If you want to continue the script you have to use if, while or switch

Marian
ASKER CERTIFIED SOLUTION
Avatar of heddesheimer
heddesheimer

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial