It is true that statements and declarations in PHP generally have an ending symbol. However, attributes are not a standalone statement or declaration, but rather modifiers on a declaration. They do not stand alone, but are always followed by a declaration with which the metadata is associated. This is similar to the public and static keywords that modify a method, or a type declaration that modifies a
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$empty = []; | |
$uniform = []; | |
$integer = []; | |
$string = []; | |
$mixed = []; | |
$assoc = []; | |
for ($i = 0; $i < 500000; $i++) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
param( | |
[string] $server | |
) | |
$ErrorActionPreference = "Stop" | |
$sitePathArr = Invoke-Command -ComputerName $server -ScriptBlock { | |
(Get-Website mySite).PhysicalPath.Split("\") | |
} | |
$currentPath = $sitePathArr[0..($sitePathArr.count - 2)] -join "\" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Analysis of https://gist.github.com/nikic/7b0afaf4d8b1a1087cdb61cd1e776594 | |
18 namespaces with backtick uses | |
22 packages with backtick uses | |
Total uses in top 2K packages: 72 | |
19 projects have 5 or fewer usages | |
14 projects only have 1 or 2 usages | |
array ( | |
'james-heinrich/getid3' => 14, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
error_reporting(E_ALL); | |
$opts = getopt('f:d:rb:', ['ext:', 'php:', 'diff::']); | |
if ((int)isset($opts['d']) + (int)isset($opts['f']) !== 1) { | |
$self = basename(__FILE__); | |
echo <<<EOF | |
Usage: | |
php $self -f<php_script> [-b] [--php <path_to_php>] [ --diff [<file>]] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// parse the output of https://gist.github.com/nikic/b5f811e0423bf051f4492cd6e0c0273e | |
$contents = file('alternative_array_syntax_usage.txt'); | |
$match = '/home/nikic/package-analysis/sources/'; | |
$matchLen = strlen($match); | |
$parseErrorMatch = 'Parse error:'; | |
$parseErrorLen = strlen($parseErrorMatch); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- ================================================= | |
-- Author: Theodore Brown | |
-- Create date: 2016-12-02 | |
-- Description: Sort alphanumeric strings naturally! | |
-- ================================================= | |
CREATE FUNCTION [dbo].[fnNaturalSort] | |
( | |
@string nvarchar(255) | |
) | |
RETURNS nvarchar(264) |