What is ucfirst, ucwords, lcfirst, strtolower, strtoupper function in php?

What is ucfirst, ucwords, lcfirst, strtolower, strtoupper function in php?  ucfirst : Make a string’s first character uppercase <?php $var = ‘anwar hossain!’; $var = ucfirst($var);             // Anwar hossain! $bar = ‘HELLO WORLD!’; $bar = ucfirst($bar);             // HELLO WORLD! $bar = ucfirst(strtolower($bar)); // Hello world! ?> ucwords : Uppercase the first character of each word in a string. <?php $var …

Continue Reading

What is Constructors and Destructors?

What is Constructors and Destructors? CONSTRUCTOR : PHP allows developers to declare constructor methods for classes. Classes which have a constructor method call this method on each newly-created object, so it is suitable for any initialization that the object may need before it is used. DESTRUCTORS : PHP 5 introduces a destructor concept similar to that of other object-oriented languages, …

Continue Reading

What are the different types of errors in php?

What are the different types of errors in php? Notices: These are trivial, non-critical errors that PHP encounters while executing a script – for example, accessing a variable that has not yet been defined. By default, such errors are not displayed to the user at all – although, as you will see, you can change this default behaviour. Warnings: These …

Continue Reading

Explain include(), include_once, require() and require_once.

Explain include(), include_once, require() and require_once: include() The include() function takes all the content in a specified file and includes it in the current file. If an error occurs, the include() function generates a warning, but the script will continue execution. include_once() File will not be included more than once. If we want to include a file once only and …

Continue Reading

How can convert the time zones using PHP?

date_default_timezone_set function on PHP 5.1.0 <?php // Discover what 8am in Tokyo relates to on the East Coast of the US // Set the default timezone to Tokyo time: date_default_timezone_set(‘Asia/Tokyo’); // Now generate the timestamp for that particular timezone, on Jan 1st, 2000 $stamp = mktime(8, 0, 0, 1, 1, 2000); // Now set the timezone back to US/Eastern date_default_timezone_set(‘US/Eastern’); …

Continue Reading