PSR
NUM TITLE 번역 1 Basic Coding Standard 블로그 3 Logger Interface 번역 중
| <?php | |
| /** | |
| * Interpolates context values into the message placeholders. | |
| */ | |
| function interpolate($message, array $context = array()) | |
| { | |
| // build a replacement array with braces around the context keys | |
| $replace = array(); | |
| foreach ($context as $key => $val) { |
PSR
NUM TITLE 번역 1 Basic Coding Standard 블로그 3 Logger Interface 번역 중
| <?php | |
| namespace Vendor\Model; | |
| class Foo | |
| { | |
| const VERSION = '1.0'; | |
| const DATE_APPROVED = '2012-06-01'; | |
| } |
| <?php | |
| // PHP 5.2.x and earlier: | |
| class Vendor_Model_Foo | |
| { | |
| } |
| <?php | |
| // PHP 5.3 and later: | |
| namespace Vendor\Model; | |
| class Foo | |
| { | |
| } |
| <?php | |
| // declaration | |
| function foo() | |
| { | |
| // function body | |
| } | |
| // conditional declaration is *not* a side effect | |
| if (! function_exists('bar')) { | |
| function bar() |
| <?php | |
| // side effect: change ini settings | |
| ini_set('error_reporting', E_ALL); | |
| // side effect: loads a file | |
| include "file.php"; | |
| // side effect: generates output | |
| echo "<html>\n"; |
| class Solution { | |
| func finalPrices(_ prices: [Int]) -> [Int] { | |
| var answer = [Int]() | |
| for (index, price) in prices.enumerated() { | |
| if index+1 == prices.count { | |
| answer.append(price) | |
| } else { | |
| if price >= prices[index+1] { | |
| let discount = prices[index+1] |
| override func viewDidLoad() { | |
| super.viewDidLoad() | |
| } |
| func swapTwoInts(a: Int, b: Int) -> (Int, Int) { | |
| (b, a) | |
| } | |
| var firstNumber = 10 | |
| var secondNumber = 30 | |
| print("firstNumber : \(firstNumber)") | |
| print("secondNumber : \(secondNumber)") |