Linki

PHP function reference
PHP at w3schools

Snippety

  1. other
    error_reporting(E_STRICT); // E_ALL
    htmlspecialchars(string)
    print_r($_SERVER)
    print_r($GLOBALS)

    // echo current time
    date_default_timezone_set('Europe/Warsaw');
    echo "hi " . date('Y-m-d H:i:s');
  2. stringi
    $pos = strpos($s, "x");
    if ($pos !== FALSE) {
      echo substr($s, 0, $pos);
      }
  3. regex
    $uri = preg_replace('/-en$/', '', $uri);
    if ( preg_match('/^.*-en$/', $uri) == 1)
  4. syntax
    for  ($i = 1; $i <= 10; $i++) { echo $i; }

    function insert_html_file($html_file_name) {
    print($html_file_name);
    }
  5. tablice
    echo count($a);
  6. variables
    $uri = $_ENV['REQUEST_URI'];
    $path = $_SERVER['DOCUMENT_ROOT'];
    $urlGetVariable = $_GET["test"];