<!--getenv HTTP_USER_AGENT--> <!--ifsubstr $exec_result Mozilla--> Hey, you are using Netscape! <!--endif-->
class Title { var $mTextform = ''; var $mDbkeyform = ''; function getTitleFromId( $id ) { // ... } }
class WallController extends ArticleCommentsModule { private $helper; protected $sortingType = 'index'; const WALL_MESSAGE_RELATIVE_TIMESTAMP = 604800; public function __construct() { // ... } public function init() { // ... } }
<?php ... ?>
<script language="php"> ... </script>
<? ... ?>
<% ... %>
<p>This is going to be ignored.</p> <?= 'While this is going to be parsed.'; ?> <p>This will also be ignored.</p>
<?php if ($expression) { ?> <strong>This is true.</strong> <?php } else { ?> <strong>This is false.</strong> <?php } ?>
<?php if( $expression ): ?> <strong>This is true.</strong> <?php else: ?> <strong>This is false.</strong> <?php endif; ?>
If you’re unaware of the usual beef most developers have with PHP, it tends to revolve around:
- ugly syntax,
- lack of some necessary features that other languages have (prior to 5.3, namespacing, closures),
- inconsistent function naming, usage, and other quirks,
- mix of procedural and OO-ness,
- the fact that 80-90% of PHP projects are probably gigantic piles of shit.
SILEX | ||
CodeIgniter | ||
PHP Lint | ||
php | 55 | 532 | 89 | 322 |
python | 37 | 173 | 98 | 202 |
ruby | 14 | 79 | 48 | 78 |
perl | 21 | 88 | 79 | 139 |
Dane z dnia 20 listopada 2013.
If you are capable of making wise software design decisions, PHP is a great choice to build your web application with.