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)

Link to comment
Share on other sites

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).

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.