|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2006-08-22 12:16 UTC] dtyschenko at soft-ukraine dot com
Description:
------------
Sometimes I need to run few functions that can throw new exception
Reproduce code:
---------------
<?php
$errors = array();
try {
$Item->Title($_POST['title']);
} catch (InvalidArgument $e) {
$errors[] = $e->getMessage();
}
try {
$Item->Content($_POST['content']);
} catch (InvalidArgument $e) {
$errors[] = $e->getMessage();
}
// In this case tryeach operator can be very usefull
tryeach {
$Item->Title($_POST['title']);
$Item->Content($_POST['content']);
} catch (InvalidArgument $e) {
$errors[] = $e->getMessage();
}
?>
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 16:00:01 2025 UTC |
What's the problem with this ? try { $Item->Title($_POST['title']); $Item->Content($_POST['content']); } ...