$ git config --global init.defaultBranch main
#!/usr/bin/env php | |
<?php | |
error_reporting(E_ALL & ~E_DEPRECATED & ~E_WARNING); | |
// money_format() format specification string elements | |
$fillChar = '(=.){0,1}'; | |
$suppressGroupingChars = '(\^){0,1}'; | |
$posNegFormatStyle = '(\+|\(){0,1}'; | |
$suppressCurrencySymbol = '(!){0,1}'; | |
$leftJustify = '(-){0,1}'; |
#!make | |
########################## Variables ##################### | |
HERE := $(dir $(realpath $(firstword $(MAKEFILE_LIST)))) | |
########################################################## | |
# I encountered this idea from my colleague Roman Basayev | |
.PHONY: | |
default: help |
This is really short, but it saved the day, okay?
You're migrating from PHP 5 to PHP 7 - about time, isn't it? - and you're replacing $php_errormsg
with error_clear_last()
and error_get_last()
, but you realize the newer functions are PHP 7 only, and you can't deploy the updated code to your
thousands of servers all at once, because you live in the real world.
This particular application has to run under both PHP 5 and PHP 7.
Modernizing PHP 4 style constructors in both a forwards and backwards-compatible fashion requires two things:
- renaming the PHP4 style constructor to
__construct()
. - implementing a PHP4 style method that invokes the PHP5
__construct()
.
The typical fix of renaming the PHP 4 style constructor to __construct
works perfectly for code that is available to be scanned and fixed.
If code over which the maintainers have no control extends any of these classes and invokes the constructors by the old method name, that extending code will break, because it will be calling a method name which no longer exists.
<?php | |
// analyse-codebase.php | |
// Runs several PHP static analysis tools; assumes *.phar names | |
// This could be done with a shell/batch script, instead of php. | |
// If running under Windows, use paths like 'C:\desired\path\to\file' | |
// If running under *nix, use paths like '/desired/path/to/file' | |
// If PHP binary is not in your command path, you need to specify path to it. | |
// const PHP_EXE = '/the/path/to/your/PHP/executable'; |
Setup instructions for "PHP Dependency Management with Composer" workshop
The main thing you'll want is for Composer to be installed; we'll do this during the session, if needed.
Goal is for you to use your existing laptop dev environment:
- No special VM to download
- Friendly to conference Wi-fi
- Windows
- https://getcomposer.org/Composer-Setup.exe
#!/usr/bin/bash | |
# On Windows, using Gitbash and Zend Studio PHP binary. This file not be needed for *nix with PHP truly "installed." | |
# Kind of lame, but I use this to run php scripts: | |
# $ ./php.sh update-all-my-qa-tools.php | |
/c/Program\ Files/Zend/Zend\ Studio\ 13.0.0/plugins/com.zend.php.debug.debugger.php56.win32_13.0.1.v20151112-2045/resources/php56/php "$@" |
I hereby claim:
- I am clarkphp on github.
- I am clarkeveretts (https://keybase.io/clarkeveretts) on keybase.
- I have a public key whose fingerprint is 268F 71BA E744 AF06 9A36 A95E 49F8 FF51 DFAD DFAA
To claim this, I am signing this object: