PHP (Hypertext Preprocessor)

PHP Documentation

Der PHP Tag - Kapitel 10. Grundlagen der Syntax

In PHP-Datein wird PHP mit dem PHP-Tag eingebunden.
Beispiel:

<?php $message="This is text in PHP Code"; echo($message); ?>

//returns This is text in PHP Code

Beispiel mit "short_open_tag":

<?php $message="This is text in PHP Code"?><?=($message);?>

//returns  This is text in PHP Code

php.ini Einstellung - php.net: Beschreibung der php.ini-Direktiven des Sprachkerns
; Allow the <? tag.  Otherwise, only <?php and <script> tags are recognized.
; NOTE: Using short tags should be avoided when developing applications or
; libraries that are meant for redistribution, or deployment on PHP
; servers which are not under your control, because short tags may not
; be supported on the target server. For portable, redistributable code,
; be sure not to use short tags.
;short_open_tag = Off
short_open_tag = On

Mehrzweckseiten Syntax:

Mehrzweckseiten <?php if( condition ){ ?>  
<?php } else { ?>
<?php 
?>
Alternative Form der if-else-Struktur <?php if( condition ): ?>
<?php 
else: ?>
<?php 
endif; ?>

PHP Code highlighting

phps files:
Das enthaltene PHP verwenden
Apache 2.0 auf Unixsystemen

Um .phps-Dateien als PHP-Quelldateien interpretieren zu lassen, fügen wir die folgende Anweisung hinzu:

<FilesMatch "\.phps$">
          SetHandler application/x-httpd-php-source
</FilesMatch>

show_source (PHP 4, PHP 5)
highlight_string (PHP 4, PHP 5)
PHP-Highlighting-Funktion verbessern
Highlight Source Code in Your PHP Application

PHP & XML

PHP 5 & XML - Beispiel mit SimpelXML
PHP 5 & AMP (Alle meine Passworte) XML import in KeePassX XML
PHP 5 & Dreamweaver template logfile to FileZilla XML ftp queue file
PHP 5 & Tortoise logfile to FileZilla XML ftp queue file

XML RSS Feed in PHP erstellen

XML RSS FEED mit PHP + CDATA ( createCDATASection)

PHP time functions

strftime
setlocal - MSDN Country/Region Strings

PHP und Bilddateien - LX. Grafik-Funktionen

 

GD Library

PHP ist in der Lage, Bild Datein neu zu erstellen. Dafür benötigt PHP jedoch eine sogenannte GD Library. Diese GD Library wird als PHP Extension in der php.ini Datei aktiviert und hat den Namen php_gd2.dll. Diese Datei ist bereits in der PHP-Installation enthalten.

Zeile 620: extension=php_gd2.dll

Methoden in PHP für Bilder:
getimagesize
imagecreatetruecolor
imagecreatefromjpeg
imagecopy
imagecopyresampled
imagecopyresized
imagejpeg

PHP und reguläre Ausdrücke

Funktionen für reguläre Ausdrücke:
RegEx Beispiele:

JavaScript Funktionsaufruf finden

zu untersuchener Text:
onclick="return toggleProcedure('The Quick green Brown Fox')"
onclick="return toggleProcedure('The Quick yellow Brown Fox')"
regulärer Ausdruck (regstr):
onclick=\"return toggleProcedure([^\"]{0,})\"
Result:
Array
(
    [0] => Array
        (
            [0] => onclick="return toggleProcedure('The Quick green Brown Fox')"
            [1] => onclick="return toggleProcedure('The Quick yellow Brown Fox')"
        )

    [1] => Array
        (
            [0] => ('The Quick green Brown Fox')
            [1] => ('The Quick yellow Brown Fox')
        )

)
PHP Code:
<?php
error_reporting
(E_ALL);

// Text bzw. String der durchsucht werden soll 
$TXT = <<<EOF
onclick="return toggleProcedure('The Quick green Brown Fox')"
onclick="return toggleProcedure('The Quick yellow Brown Fox')"
EOF;

// das Suchmuster mit Delimiter und Modifer (falls vorhanden) 
$pattern '/onclick=\"return toggleProcedure([^\"]{0,})\"/';

// RegEx mit preg_match_all() auswerten 
preg_match_all($pattern$TXT$array);

// formatierte Ausgabe
echo '<pre>'print_r($arraytrue), '</pre>';
?>

Links:
REGEX TESTER - Regular Expressions - Regulärer Ausdrücke online testen

Delicious PHP feed Delicious rss icon

Example from: jQuery Clone to Add Dynamic Data - JSON Files via Javascript / jQuery

»

Tags: