What Is PHP ?

PHP

Hypertext pre-processor.

It is a general purpose server side scripting language that is used to develop:-

  • Static websites
  • Dynamic websites
  •  Web applications

The client computers accessing the PHP scripts require a web browser only.

A PHP file contains PHP tags and ends with the extension “.php”.
PHP is open source and free.

PHP as it’s known today is actually the successor to a product named PHP/FI. Created in 1994 by Rasmus Lerdorf, the very first incarnation of PHP was a simple set of Common Gateway Interface (CGI) binaries written in the C.
 

Php Syntax

<?php echo ‘My first code’;  ?>

A PHP file can also contain tags such as HTML and client side scripts such as JavaScript.

What is File structure of WordPress theme

File structure of WordPress theme

The main files used in wordpress are:-

  1. index.php :- for index page.
  2. single.php :- for single post page.
  3. page.php :- display the static pages.
  4. category.php :-  Display the category page.
  5. archive.php :- For archive page display.
  6. tag.php :- For display the tags page.
  7. author.php :- For display author page.
  8. search.php :- For display the search result page.
  9. 404.php :- For display 404 error page.
  10. taxonomy.php :- For display the taxonomy archive.
  11. attachment.php :- For managing the single attachments page.
  12. header.php :- For managing top part of page.
  13. footer.php :- For manage bottom part of pages.

How to get browserName in PHP

function getBrowser() {

global $user_agent;

$browser_array  =   array(
‘/msie/i’       =>  ‘Internet Explorer‘,
‘/firefox/i’    =>  ‘Firefox’,
‘/safari/i’     =>  ‘Safari’,
‘/chrome/i’     =>  ‘Chrome’,
‘/opera/i’      =>  ‘Opera’,
‘/netscape/i’   =>  ‘Netscape’,
‘/maxthon/i’    =>  ‘Maxthon’,
‘/konqueror/i’  =>  ‘Konqueror’,
‘/mobile/i’     =>  ‘Handheld Browser’
);

foreach ($browser_array as $regex => $value) { 

if (preg_match($regex, $user_agent)) {
$browser    =   $value;
}

}
$browser        =  $browser ? $browser : “Unknown Browser”;
return $browser;

}

how to remove white space in mysql