PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
mudkicker
Forum Contributor
Posts: 479 Joined: Wed Jul 09, 2003 6:11 pm
Location: Istanbul, TR
Contact:
Post
by mudkicker » Wed Nov 12, 2003 4:18 am
Hi people,
I've something to ask and it's very important for me in my project.
Is there any function or code that works like
in ASP?
Have A Nice Day!
twigletmac
Her Royal Site Adminness
Posts: 5371 Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK
Post
by twigletmac » Wed Nov 12, 2003 4:57 am
Forgive those of us that have no ASP experience but what exactly does on error resume next do and in what context.
Mac
hedge
Forum Contributor
Posts: 234 Joined: Fri Aug 30, 2002 10:19 am
Location: Calgary, AB, Canada
Post
by hedge » Wed Nov 12, 2003 8:48 am
put an @ sign in front of the function call you expect to fail.
mudkicker
Forum Contributor
Posts: 479 Joined: Wed Jul 09, 2003 6:11 pm
Location: Istanbul, TR
Contact:
Post
by mudkicker » Wed Nov 12, 2003 12:22 pm
actually i don't know ASP so much I'm good at PHP but in the workplace my friends who is programming with ASP they are using this code. it ignores an error in the code and continues to execute.
Gen-ik
DevNet Resident
Posts: 1059 Joined: Mon Aug 12, 2002 7:08 pm
Location: London. UK.
Post
by Gen-ik » Wed Nov 12, 2003 12:36 pm
"On error resume next" is also used by VBScript.
It's pretty simple to do in PHP....
Code: Select all
<?php
$result = @mail($to, $subject, $body, $headers);
// Use the following bit to do something if and error occured.
if(!$result)
{
// An error occured so do something
}
?>
I'm sure there's a global way of doing it though..... but I can't remember it
scorphus
Forum Regular
Posts: 589 Joined: Fri May 09, 2003 11:53 pm
Location: Belo Horizonte, Brazil
Contact:
Post
by scorphus » Wed Nov 12, 2003 12:45 pm
"On Error Resume Next" is a poor kind of approximation to try{}catch(){}
JAM
DevNet Resident
Posts: 2101 Joined: Fri Aug 08, 2003 6:53 pm
Location: Sweden
Contact:
Post
by JAM » Wed Nov 12, 2003 1:31 pm
As said, @function is the php way of 'error resume next' VBA style.
But don't do that. It will harm you more than serve you in the end (of course, if there isn't a very good reason for it). Just my 2cents.
mudkicker
Forum Contributor
Posts: 479 Joined: Wed Jul 09, 2003 6:11 pm
Location: Istanbul, TR
Contact:
Post
by mudkicker » Wed Nov 12, 2003 6:04 pm
Ok, thanks for posts. Really appreciated!!!
EvilWalrus
Site Admin
Posts: 209 Joined: Thu Apr 18, 2002 3:21 pm
Location: Springmont, PA USA
Post
by EvilWalrus » Thu Nov 13, 2003 7:54 am
In a loop, the continue and break keywords can also be used for further checking.