PHP

PHP is an open source server-side scripting language designed for Web development to produce dynamic Web pages. It is one of the first developed server-side scripting languages to be embedded into an HTML source document rather than calling an external file to process data. The code is interpreted by a Web server with a PHP processor module which generates the resulting Web page. It also has evolved to include a command-line interface capability and can be used in standalone graphical applications. PHP can be deployed on most Web servers and also as a standalone shell on almost every operating system and platform, free of charge. PHP was a competitor to Microsoft's Active Server Pages (ASP) server-side script engine and similar languages, but gradually received better acceptance than ASP and by now PHP is installed on more than 20 million Web sites and 1 million Web servers. Notable software that uses PHP includes Drupal, Joomla, MediaWiki, and WordPress.

PHP was originally created by Rasmus Lerdorf in 1995. The main implementation of PHP is now produced by The PHP Group and serves as the formal reference to the PHP language. PHP is free software released under the PHP License, which is incompatible with the GNU General Public License (GPL) due to restrictions on the usage of the term PHP.

While PHP originally stood for Personal Home Page, it is now said to stand for PHP: Hypertext Preprocessor, a recursive acronym.

example.php
<?php
     // try-catch blok u kome se otvara konekcija na bazu i vrsi upit
     try {
         $konekcioni_string = "sqlite:c:/wamp/Sqlite/preduzece.db";
         // $dbh objekat pamti konekciju prema bazi
         $dbh = new PDO($konekcioni_string);
         // konstrukcija SQL izraza
         $sql = "SELECT * FROM radnik";
         // $dbh->query() vraca PDOStatement objekat
         $pdo_izraz = $dbh->query($sql);
         // Svi podaci se vracaju u obliku niza asocijativnih nizova
         $niz = $pdo_izraz->fetchALL(PDO::FETCH_ASSOC);
         // Iterisanje po vracenim rezultatima
         echo "<table cellpadding='5' border='1'>";
         echo "<tr><th>Ime</th><th>Adresa</th><th>Plata</th></tr>";
         foreach($niz as $radnik) {
             echo "<tr><td><b>".$radnik['ime']."</b></td>";
             echo "<td>".$radnik['adresa']."</td>";
             echo "<td>".$radnik['plata']."</td></tr>";
         }
         echo "</table>";
        }
        catch(PDOException $e) {
          echo "GRESKA: ";
          echo $e->getMessage();
     }
     $dbh = null;
?>

See also

  • Free software portal
  • Computer programming portal
  • Comparison of programming languages
  • Comparison of PHP frameworks
  • List of AMP packages
  • List of PHP editors
  • PHP accelerator
  • PHP-FPM
  • PHP-GTK
  • Template processor
  • EasyPHP
  • XAMPP
  • BitNami AMP Stacks
  • Zend Certified Engineer
  • Zend Server Community Edition

Text taken from Wikipedia®

 
goran.jovcic.txt · Last modified: 2014/02/11 23:15 by goran.jovicic
 
Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki