Zend Anwar

Full stack web developer

Author: zendnwar

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 […]

Read More

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 […]

Read More

What are the differences between GET and POST methods in form submitting?

What are the differences between GET and POST methods in form submitting? On the server side, the main difference between GET and POST is where the submitted is stored. The $_GET array stores data submitted by the GET method. The $_POST array stores data submitted by the POST method. On the browser side, the difference […]

Read More

What is the difference between the functions unlink and unset?

unlink() deletes the given file from the file system. unset() makes a variable undefined.

Read More

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 […]

Read More

if Statement Uses else

if Statement uses else When working with the if statement, you will often want to define an alternative block of code that should be executed if the expression you are testing evaluates to false. You can do this by adding else to the if statement followed by a further block of code: if ( expression […]

Read More

if Statement in php

if Statement in php An if statement is a way of controlling the execution of a statement that follows it (that is, a single statement or a block of code inside braces). The if statement evaluates an expression between parentheses. If this expression results in a true value, the statement is executed. Otherwise, the statement […]

Read More

PHP Date() Function

date-> Format a local time/date. date(format,timestamp) format            : Required. Specifies the format of the timestamp timestamp     : Optional. Specifies a timestamp. Default is the current date and time The following characters are recognized in the format parameter string format character Description Example returned values Day — — d Day […]

Read More

What is str_split?

str_split : Convert a string to an array <?php $str = “Anwar Hossain”; $arr1 = str_split($str); $arr2 = str_split($str, 3); print_r($arr1); print_r($arr2); ?> OUTPUT: Array ( [0] => A [1] => n [2] => w [3] => a [4] => r [5] => [6] => H [7] => o [8] => s [9] => s […]

Read More

Regx validation in Zend Framework

Regx validation in Zend Framework Here showing Email validation.  $email = new Zend_Form_Element_Text(’email_address’); $email->setLabel(‘Email Address:’) ->addValidators( array( array(‘regex’, false, array(‘pattern’ => ‘/^.+@.+[.].{2,}$/i’)))) ->setRequired(true) ->setAttribs(array(‘id’ => ’email_address’, ‘class’ => ‘input-text-field’)) ->addErrorMessage(‘please enter a valid email address’);

Read More