Is anyone can help me about why I am getting this error? PHP Warning: sprintf(): Too few arguments in but no sprintf in The related function is: function httpcheckif(){ return sprintf( "%s://%s%s", isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off' ? 'https' : 'http', $_SERVER['SERVER_NAME'] ); } PHP:
printf is one of those commands I never really understood why they exist in the first place.... as if string addition is so magically hard or that it's somehow worth running a parser under a parser under an interpreter. Which is why I'd have scrapped that and simply done: function httpcheckif(){ return ( isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off' ? 'https' : 'http' ) . '://' . $_SERVER['SERVER_NAME']; } Code (markup): Even in C all "printf" type commands are is a legacy of the fact that the early compilers were all single-pass trash... that it even exists in modern languages like PHP is more a monument to stupidity than it is functionality.