Loading...
Loading...
Tools
Quick reference for PHP coding style standards: PSR-1, PSR-2, and PSR-12.
Runs locally in your browser. No data is sent to any server.
Files MUST use only <?php and <?= tags.
<?php echo 'Hello';
Files MUST use only UTF-8 without BOM for PHP code.
Files SHOULD either declare symbols OR cause side-effects, but not both.
<?php
// Good: only declarations
function foo() {}
class Bar {}Namespaces and classes MUST follow PSR-4 autoloading.
namespace Vendor\Package;
class MyClass {}Class constants MUST be declared in all upper case with underscore separators.
class Foo {
const VERSION = '1.0';
const DATE_APPROVED = '2012-06-01';
}Property names should follow a consistent convention (camelCase recommended).
class Foo {
public $camelCase;
}Method names MUST be declared in camelCase.
class Foo {
public function myMethod() {}
}