'I want to avoid errors in my function php

how can I avoid errors in my function for example

function subtract($a,$b) {return $a-$b ;}

I want the function to return message instead of error for instance

echo subtract("string",5) ; // output fatal error

instead I want it to return message (I don't want to use if condition )

php


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source