Jump to content

Default Error Messages in PHP


ignace

Recommended Posts

@rajiv I think Daniel already partially answered my question but what I actually wanted is that when I define a user function and the user gives a wrong format (array instead of string) then it would report that error instead of me writing:

 

__FUNCTION__ expects parameter two to be string, gettype($variable) given.

 

It's possible I think when using the SPL extension:

 

function functionName(SplString $param1, SplString $param2)

You can type hint non-scalar parameter types. It'll result in a run-time fatal error if a non-matching type is given. You could write an RFC at http://wiki.php.net (and send it to the internals list) to have what I believe Java calls automatic boxing and unboxing. This would allow you to pass e.g. primitives like ints to an SplInt without having to do new SplInt(42).

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.