# Late defined classes

- Thread: https://externals.io/message/43421
- Original archive: https://news-web.php.net/php.internals/43421
- Started by Paul Tarjan on 2009-03-20T01:28:39+00:00
- Messages: 1
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #43421 — Paul Tarjan — 2009-03-20T01:28:39+00:00

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

Hi all,

This works (albeit with an abstract class error):

---
class Result implements Countable { }
$result = new Result();
---

Switching their order:

---
$result = new Result();
class Result implements Countable { }
---

gives : 

---
Fatal error: Class 'Result' not found in /tmp/not_defined.php on line 2
---

If I remove the interface, everything is peachy:

---
$result = new Result();
class Result { }
---

So as a user of PHP I was quite surprised that a class with an interface
must be in the code flow to be defined.

Is there anything (easy) that we can do to support this case?

Thanks
Paul
