Skip to content

Commit

Permalink
Merge pull request #19 from jrfnl/feature/finishing-touches
Browse files Browse the repository at this point in the history
Feature/finishing touches
  • Loading branch information
jrfnl committed Jun 22, 2015
2 parents bb4165a + 79c552e commit 4d041c0
Show file tree
Hide file tree
Showing 111 changed files with 8,502 additions and 6,284 deletions.
1 change: 1 addition & 0 deletions .scrutinizer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ filter:
excluded_paths:
- 'bin/*'
- 'page/jquery*'
- 'include/PHP-cast-to-type/*'
checks:
php:
fix_php_opening_tag: false
Expand Down
109 changes: 68 additions & 41 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,86 +1,113 @@
PHP-cheat-sheet-extended
========================
[![GitHub license](https://img.shields.io/badge/license-GPLv3-blue.svg)](https://raw.githubusercontent.com/jrfnl/PHP-cheat-sheet-extended/master/LICENSE.md)
[![Build Status](https://travis-ci.org/jrfnl/PHP-cheat-sheet-extended.svg?branch=master)](https://travis-ci.org/jrfnl/PHP-cheat-sheet-extended)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/jrfnl/PHP-cheat-sheet-extended/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/jrfnl/PHP-cheat-sheet-extended/?branch=master)


### View these cheat sheets live at [PHPCheatsheets.com](http://phpcheatsheets.com/)

Much extended version of the [Blueshoes PHP cheat sheet](http://www.blueshoes.org/en/developer/php_cheat_sheet/) for variable type juggling.

#### Much extended version of the [Blueshoes PHP cheat sheet](http://www.blueshoes.org/en/developer/php_cheat_sheet/) for variable type juggling.


##### Features:
* Lots of extra variables being tested
* Lots of extra comparisons and tests
* Variable arithmetic
* Results available based on various PHP versions
* Lots of extra variables being tested.
* Lots of extra comparisons and tests.
* Variable arithmetic.
* Results available for a wide variety of PHP versions.


##### Contributing:
Suggestions for additional test variables, additional comparisons, tests or other improvements are very welcome. Just open an issue or send in a pull request for it.
Suggestions for additional test variables, additional comparisons, tests or other improvements are very welcome. Just [open an issue](https://github.com/jrfnl/PHP-cheat-sheet-extended/issues) or send in a [pull request](https://github.com/jrfnl/PHP-cheat-sheet-extended/pulls) for it.


##### About the static versions of the sheets
##### About the static versions of the sheets:

Static versions of the cheatsheets are generated using a variety of PHP versions.

These PHP versions will include:
* [Always] Latest release for each minor PHP version at the time of (re-)generation of the static sheets
* [Always] The PHP versions included in [Ubuntu LTS releases](http://distrowatch.com/table.php?distribution=Ubuntu)
* [Selectively] Popular minor releases based on [worldwide usage statistics](http://w3techs.com/technologies/details/pl-php/all/all) at the time of (re-)generation of the static sheets
* [Selectively] Previously included versions if no other close minor release will be included
* [Always] Latest release for each minor PHP version at the time of (re-)generation of the static sheets.
* [Always] The PHP versions included in [Ubuntu LTS releases](http://distrowatch.com/table.php?distribution=Ubuntu).
* [Selectively] Popular minor releases based on [worldwide usage statistics](http://w3techs.com/technologies/details/pl-php/all/all) at the time of (re-)generation of the static sheets.
* [Selectively] Previously included versions if no other close minor release will be included.

In general, a balance is sought between significance and variety.


#### Credits:
[Elephpant photo](http://www.flickr.com/photos/jakobwesthoff/3231273333/) by Jacob Westhoff
[Sad Elephpant photo](http://www.flickr.com/photos/gluek/100179589/) by Gluek
[Elephpant photo](http://www.flickr.com/photos/jakobwesthoff/3231273333/) by Jacob Westhoff.
[Sad Elephpant photo](http://www.flickr.com/photos/gluek/100179589/) by Gluek.


#### Changelog:

##### 1.3 (Jun 2015): Get ready for PHP 7!
* New tests:
- `<=>` in variable comparisons (PHP7+ only).
- `$x ?? ...` in variable tests (PHP7+ only).
- `intdiv()` in variable arithmetics (PHP7+ only).
- `preg_match()` with unicode property codes in variable string tests (PHP5.1+).
* Added two new variables specifically for the unicode property tests.
* Renewed static sheets based on currently available and most used versions:
- Added static sheets for **PHP 7.0.0-alpha1**, 5.6.10, 5.6.8, 5.6.0, 5.5.26, 5.5.24, 5.5.22, 5.4.42, 5.4.39, 5.4.36.
- Removed static sheet generation for PHP 5.6.4, 5.5.21, 5.5.20, 5.5.18, 5.4.37, 5.4.35 and 4.3.9.
* Updated CastToType submodule to v2.0 which brings object casting via that class for all PHP versions in line with PHP7 and fixes a bug in object casting for PHP <= 5.1.

Also:
* Fixed a hiccup where the "Filter" tab would be shown in PHP 5.1, while the filter extension is only available in PHP 5.2+.
* Fixed a bug on the "test" cheatsheet where the row variable header would not display properly in the right hand column on low PHP versions.
* Improved grouping of PHP error messages.
* Added some more user facing information about the tests run and version quirks.
* Fixed js error in sitemap stylesheet.
* Fixed a faulty redirect in .htaccess.
* Minor UI improvements.
* Tidying up.


##### 1.2.0.1 (Feb 2015)
* Added sitemaps
* Added sitemaps.


##### 1.2 (Feb 2015)
* New tests:
- `pow()` in variable arithmetic
- `**` (PHP 5.6+) in variable arithmetic
- `.` (concatenation) in variable arithmetic - for want of better place
* Added two new float variables
- `pow()` in variable arithmetic.
- `**` (PHP 5.6+) in variable arithmetic.
- `.` (concatenation) in variable arithmetic - for want of better place.
* Added two new float variables.
* Lots of usability improvements:
- Select PHP version via dropdown
- PHP version persists across sheets
- Variable legend now auto-expand when user clicks on variable 'footnote' link
- 'Pretty' (semantic) urls
- Better window titles
- Better error handling (404)
- Select PHP version via dropdown.
- PHP version persists across sheets.
- Variable legend now auto-expand when user clicks on variable 'footnote' link.
- 'Pretty' (semantic) urls.
- Better window titles.
- Better error handling (404).
* Static sheets now available in lots more versions (30!), including PHP 5.5, 5.6 which weren't available until now. Retired some older versions which have close versions available anyhow.
* Fixed:
- Variable legend for binary integer was missing
- Variable legend for binary integer was missing.

Also:
* Added donate to charity button
* Change over to absolute rather than relative urls
* Minor html and css fixes
* Script to autogen (nearly) all static sheets
* Updated cast-to-type submodule
* Upgraded jQuery and jQuery UI to 1.11.2
* General tidying up
* Added donate to charity button.
* Change over to absolute rather than relative urls.
* Minor html and css fixes.
* Script to autogen (nearly) all static sheets.
* Updated cast-to-type submodule.
* Upgraded jQuery and jQuery UI to 1.11.2.
* General tidying up.


##### 1.1 (Feb 2014) - move to own domain
##### 1.1 (Feb 2014) - move to own domain.
* New tests:
- `abs()` in variable testing
- `abs()` in variable testing.
* New pages:
- 'other cheatsheets'
- 'about'
* New site styling for own domain
- 'other cheatsheets'.
- 'about'.
* New site styling for own domain.

Also:
* Added twitter & LinkedIn share buttons
* Upgraded jQuery to 1.11.0 and jQuery UI to v 1.10.4
* Cleaned up HTML
* Added twitter & LinkedIn share buttons.
* Upgraded jQuery to 1.11.0 and jQuery UI to v 1.10.4.
* Cleaned up HTML.


##### 1.0 (Sep 2013) - first public version
##### 1.0 (Sep 2013) - first public version.
15 changes: 9 additions & 6 deletions bin/autogen-static-sheets.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,20 +118,22 @@ function fix_content( $content ) {

// @todo Verify which rules are still needed in the renewed version.
$regex_search = array(
// Make sure there is nothing before the doctype
// Make sure there is nothing before the doctype.
0 => '`^[^<]+<!DOCTYPE html PUBLIC`',
// Make sure any potential links to php.net are properly linked
// Make sure any potential links to php.net are properly linked.
5 => '`<a href=(["\'])function\.`',
// Tidy up html whitespace around array prints
// Tidy up html whitespace around array prints.
7 => '`<th><span title="Array: \(\s+\)\s+">Array\(&hellip;\)</span>\s+</th>`',
8 => '`Array: \(<br />\s+\)<br />\s+`',
9 => '`<t([dh])([^>]*)?>array\(\)<br />\s+</t\1>`',
// Make sure the correct PHP version nr for the live sheets is shown in the version dropdown
// Make sure the correct PHP version nr for the live sheets is shown in the version dropdown.
10 => '`<option value="live"(?: selected="selected")?\s*>PHP [0-9\.-]+(?:(?:alpha|beta|rc)(?:[0-9])?)?</option>`',
// Make chosen PHP version persistent
// Make chosen PHP version persistent.
12 => '`<a href="http://([a-z\.-]+)/(arithmetic|compare|test)/" class="top-link(?: top-active)?">`',
// Make sure any potential links to php.net are properly linked
// Make sure any potential links to php.net are properly linked.
13 => '`\[(http://php\.net/manual/([^\]]+))\]`',
// HTML attributes should be using double quotes.
14 => '`<a href=\'([^\']+)\'`',
);

$regex_replace = array(
Expand All @@ -143,6 +145,7 @@ function fix_content( $content ) {
10 => '<option value="live">PHP 5.4.13</option>', // IMPORTANT! Change this if the PHP version on the server changes!!
12 => '<a href="http://$1/index.php?page=$2&amp;phpversion=php' . PHP_VERSION . '" class="top-link$3">',
13 => '[<a href="$1">$2</a>]',
14 => '<a href="$1"',
);


Expand Down
8 changes: 4 additions & 4 deletions class.vartype-php7.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class VartypePHP7 {
*/
public static $tests = array(
/**
* Functions where errors have been turned into exceptions
* Functions where errors have been turned into exceptions.
* @see class.vartype-arithmetic.php
*/
'modulus' => array(
Expand All @@ -50,7 +50,7 @@ public static function get_tests() {


/**
* PHP7 compatible version of % arithmetics
* PHP7 compatible version of % arithmetics.
*
* @param mixed $var1
* @param mixed $var2
Expand All @@ -73,7 +73,7 @@ public static function do_modulus( $var1, $var2 ) {


/**
* PHP7 compatible version of intdiv
* Test intdiv.
*
* @param mixed $var1
* @param mixed $var2
Expand All @@ -95,7 +95,7 @@ public static function do_intdiv( $var1, $var2 ) {


/**
* Helper function to handle exceptions from the overloaded functions.
* Helper function to handle exceptions from overloaded functions.
*
* @internal Exception handling is currently the same as for the PHP5 specific code, but added as separate
* method to allow for future adjustment.
Expand Down

0 comments on commit 4d041c0

Please sign in to comment.