# Throw Question

- Thread: https://externals.io/message/10553
- Original archive: https://news-web.php.net/php.internals/10553
- Started by Jason Garber on 2004-06-17T06:17:26+00:00
- Messages: 3
- RFC: throw expression (Implemented (PHP 8.0)) — https://externals.io/rfc/throw_expression.md
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · RFCs at https://externals.io/rfc.md · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #10553 — Jason Garber — 2004-06-17T06:17:26+00:00

URL: https://externals.io/message/10553#10553

Consider the following:

$x = FALSE;
$x || throw new exception('Some Assertion');

I get the following Parse Error:
error: parse error, unexpected `T_THROW` in /home/.../Z_Record.php on line 153


However, this code produces no errors..

$x = FALSE;
$x || exit;


Why is this?

Thanks,
Jason Garber

---

## #10554 — Antony Dovgal — 2004-06-17T06:22:16+00:00

URL: https://externals.io/message/10553#10554 · In reply to: #10553

On Thu, 17 Jun 2004 02:17:26 -0400
Jason Garber <jason@ionzoft.com> wrote:

> Consider the following:
> Why is this?

Take a look at the bug #28727:
http://bugs.php.net/?id=28727

---
WBR,
Antony Dovgal aka tony2001
tony2001@phpclub.net || antony@dovgal.com

---

## #10555 — Jason Garber — 2004-06-17T06:34:20+00:00

URL: https://externals.io/message/10553#10555 · In reply to: #10553

That's what I figured.  throw is a language construct.

However, from the manual (http://php.net/exit):

void exit ( int status)
       Note: This is not a real function, but a language construct.


Why does

     $x || exit;

work without a parse error?

Thanks,
Jason Garber


At 6/17/2004 10:22 AM +0400, Antony Dovgal wrote:
>On Thu, 17 Jun 2004 02:17:26 -0400
>Jason Garber <jason@ionzoft.com> wrote:
>
> > […]
>
>Take a look at the bug #28727:
>http://bugs.php.net/?id=28727
>
>---
>WBR,
>Antony Dovgal aka tony2001
>tony2001@phpclub.net || antony@dovgal.com
