- data retention
- net neutrality
- SOPA stance
- PTT stance
- patent reform
- privacy
- censorship
- "white hats" / whitsleblowers
- data leaks
- copyright reform
[**Please, don't use `mysql_*` functions in new code**](http://bit.ly/phpmsql). They are no longer maintained [and are officially deprecated](https://wiki.php.net/rfc/mysql_deprecation). See the [**red box**](http://j.mp/Te9zIL)? Learn about [*prepared statements*](http://j.mp/T9hLWi) instead, and use [PDO](http://php.net/pdo) or [MySQLi](http://php.net/mysqli) - [this article](http://j.mp/QEx8IB) will help you decide which. If you choose PDO, [here is a good tutorial](http://j.mp/PoWehJ).
Please, don't use mysql_*
functions in new code. They are no longer maintained and are officially deprecated. See the red box? Learn about prepared statements instead, and use PDO or MySQLi - this article will help you decide which. If you choose PDO, here is a good tutorial.
HTML5 will allow wrapping of blocklevel elements by a
tags:
PHP already has a lot of [built-in functions][builtin-functions]. Besides the built-in functions already provided by PHP it is also possible to define your own functions. Functions can be used to run the same code multiple times without having to add the code multiple times. It can also be used to organize your code. Generally speaking a function is a piece of code with an input, some defined actions based on the input and an output. An example of function that calculates the differences in the age of two people is:
function getAgeDifference($age1, $age2)
{
return abs($age1 - $age2);
}
<?php
function curPageURL() {
$pageURL = 'http';
if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
$pageURL .= "://";
if ($_SERVER["SERVER_PORT"] != "80") {
$pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
} else {
$pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
}
Basic selectors:
<?php // always use full php tags | |
//require 'connect.inc.php'; | |
$dbConnection = new PDO('mysql:dbname=dbtest;host=127.0.0.1;charset=utf8', 'user', 'pass'); | |
$dbConnection->setAttribute(PDO::ATTR_EMULATE_PREPARES, false); | |
$dbConnection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); | |
// mysql_* function?? Eeeeek | |
function query($query) | |
{ |
cv-pls: [Backlog](http://cvbacklog.gordon-oheim.biz/) ([mirror](http://cvbacklog.herokuapp.com/)) | [Meaning](http://gist.github.com/1689430) | [Chrome/Firefox Addon](https://github.com/cv-pls/) | [Cat Content](http://goo.gl/i04rR) | Snippets: [Mysql](https://gist.github.com/3881905) | Reference: [Errors](http://stackoverflow.com/q/12769982/367456) | [Operators](http://stackoverflow.com/questions/3737139/reference-what-does-this-symbol-mean-in-php)
cv-pls: Backlog (mirror) | Meaning | Chrome/Firefox Addon | Cat Content | Snippets: Mysql | Reference: Errors | Operators
<?php | |
function xpath_match_all($query, $html = '') | |
{ | |
static $dom; | |
static $xpath; | |
static $content; | |
if (!$dom) { | |
$dom = new DOMDocument; | |
} |
- http://www.phptutorialforbeginners.com/2012/10/php-simple-login-form-php-tutorial-for.html |