PHP array functions

List of functions that work with php arrays. array_shift() array_shift() – Shifts the first value of the array off and returns it, shortening the array by one element and moving everything down. All numerical array keys will be modified to start counting from zero while literal keys won’t be touched. array_pop() array_pop() – pop the …

PHP Display errors & Debug

To turn on error reporting 1. Set in php.ini 2. In php.code Check error logs on apache server Check errors in log file that is configured in etc/apache2/httpd.conf DEBUG Php useful debugging functions gettype($variable) – Get variable type; var_dump($variable) – Dumps information about a variable; get_defined_vars() – Return an array of all defined variables; debug_backtrace() …

WordPress plugins development

Why we need plugins on wordpress? The plugins are used to extend default WordPress functionality without touching any core files. Changing anything in the WordPress core files is a bad idea because you can break the site. In plus when WordPress is updated, any core modifications will be overwritten and lost. At this moment are …

Enable Debugging in WordPress

Before we start it is indicated to have the debug enabled. To be sure that debug mode is enabled wordpress, go to the wp-config file and add next lines For more information about enabling debug on wordpress, check out the developer docs at wordpress

Limiting upload file size in PHP

Limiting upload file size We can configure upload max file size in php.ini file, but this is a global maximum for all of PHP. If we want to configure max file size in a particular case, we can do that by adding an attribute to HTML form for MAX_FILE_SIZE. PHP will automatically detect that value …

Google AdWords Manager Defined Spend (MDS)

Manager Defined Spend (MDS) is a way for My Client Center (MCC) account users to better control the budgets of their AdWords accounts. It’s available for advertisers who meet the eligibility requirements and offer a better flexibility and efficiency for your managed accounts. If advertisers decide to move their managed accounts to MDS, they are …

Apple and Orange hackerrank solutions

Apple and Orange problem Sam’s house has an apple tree and an orange tree that yield an abundance of fruit. In the diagram below, the red region denotes his house, where s is the start point, and t is the endpoint. The apple tree is to the left of his house, and the orange tree …