To me the glaring mistake is the variable input to the function named: $street then you use an undefined variable in the preg_match named: $treetA. The error message should have told you this.
There is nothing more annoying than living at some address and then have a computer tell you that it doesn’t exist while it does. There is no fallback there, except for probably ordering stuff some place else.
In general, it’s best to just accept any text as an address.
If it’s just for one country only then the national postal operator for that country might offer a license for access to their address database, which submitted addresses could be checked and validated against
The Japanese Embassy in London would like a word about why their address isn’t valid.
Or the Gherkin. Or Anne Frank. or the Eiffel Tower?
How about any building on Broadway in New York?
Or anyone who lives in an apartment (30 green st. appt 109)?