[ad_1]
Facebook –
GitHub –
Google+ –
LinkedIn –
reddit –
Support –
thenewboston –
Twitter –
Beginner PHP Tutorial – 186 – try, throw, catch
by
Tags:
Comments
16 responses to “Beginner PHP Tutorial – 186 – try, throw, catch”
-
Hi! if you use PDO in try you need to write PDO with exception in catch?
-
I can't really wrap my head around the purpose of those function why not just echo'ing out a block of text???
-
Isn't this the same as:
$age = 16;
if($age > 18) {
echo "Old enough";
} else {
echo "Not old enough";
}In other words, I don't understand for what is this good!
-
In java is better
-
<?php
$age = 16;
try {
if ($age>18) {
echo 'Old enough.';
}
else {
throw new Exception ('Not old enough');
}
} catch (Exception $ex) {
echo 'Error: '.$ex->getMessage();
}?>
-
I also used this is my C# database program in displaying ,converting and saving image into the database
-
Guys, help me, please! Why is this useful? I can use IF ELSE and echo a message without using all these weird synttax. How can "try, throw, catch" be really useful in real world? I just dont get it!
-
Jesus man
-
not old enough for $ex?
-
i just learned this on java and seen here looks easy
-
is it me or do all these symbols have a meaning but the "->" makes sense because what it really is saying "make this even to whatever it is pointing to" by subtracting something that is greater than something to make it equal . so it really is saying that the variable is equal to a function so we have a $variable pointing -> to a function . or it can be the correct syntax to point to something … but it does make sense going by arithmetics if you think about it
-
@bradudebra next tutorial covers this. make class and extend exceptions.
-
@bradudebra
Don't you just type in other message in Exception? -
lol
-
But real question, what if there is more than one exception?
-
LOL! $ex….
Leave a Reply