PHP

Interview questions
PHP
PHP interview questions
Programming

What is the difference between $_GET and $_POST

GET: Transfers the form data through http head location & it displays the data on URL address bar. Data can be cached. Is unsecured. URL are saved in browser history. URL can be bookmarked. Transfers limited amount of data. Can’t upload the file. POST: Transfers the form data through document body. Data can not be […]

Read More
PHP
Programming

Don’t Copy Extra Variables

Some people use predefined variables to smaller-named variables to make their code appealing. This is redundant and could increase the memory of your script. Examples of variable usage: Good Approach: <?php echo strip_tags($_POST[‘myVariable’]); ?> Bad Approach: <?php $myVariable = strip_tags($_POST[‘myVariable’]); echo $myVariable; ?>

Read More
PHP
Programming
Wordpress

Insert Adsense Code Between WordPress Posts

Best place for adsense codes is between the post where it can click more. Mostly wordpress blogers use plugins for this but you can place the below code in your functions.php theme file before end of PHP “?>” tag. function ad_content($content) {     $postParas = explode(“</p>”, $content);     $content = ”;     for ($i = […]

Read More
PHP
Programming

Use isset() Instead of strlen()

This is actually a new trick, here is the example: <?php if (isset($username[5])) { // The username is at least six characters long. } ?> When you use string as an array, then each character of string is an element in the array. When you check whether an element exist and of atleast that many […]

Read More
Do NOT follow this link or you will be banned from the site!