This file contains hidden or 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 | |
namespace Vendor\Model; | |
class Foo | |
{ | |
const VERSION = '1.0'; | |
const DATE_APPROVED = '2012-06-01'; | |
} |
This file contains hidden or 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 | |
// PHP 5.2.x and earlier: | |
class Vendor_Model_Foo | |
{ | |
} |
This file contains hidden or 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 | |
// PHP 5.3 and later: | |
namespace Vendor\Model; | |
class Foo | |
{ | |
} |
This file contains hidden or 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 | |
// declaration | |
function foo() | |
{ | |
// function body | |
} | |
// conditional declaration is *not* a side effect | |
if (! function_exists('bar')) { | |
function bar() |
This file contains hidden or 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 | |
// 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"; |
This file contains hidden or 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
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] |
This file contains hidden or 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
override func viewDidLoad() { | |
super.viewDidLoad() | |
} |
This file contains hidden or 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
func swapTwoInts(a: Int, b: Int) -> (Int, Int) { | |
(b, a) | |
} | |
var firstNumber = 10 | |
var secondNumber = 30 | |
print("firstNumber : \(firstNumber)") | |
print("secondNumber : \(secondNumber)") |
This file contains hidden or 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
func swapTwoIntsWithInout(a: inout Int, b: inout Int) { | |
let temporaryA = a | |
a = b | |
b = temporaryA | |
} | |
var firstNumber = 10 | |
var secondNumber = 30 |
This file contains hidden or 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
import UIKit | |
import PlaygroundSupport | |
class TestViewController : UIViewController { | |
let labelOne: UILabel = { | |
let label = UILabel() | |
label.text = "Scroll Top" | |
label.backgroundColor = .red | |
label.translatesAutoresizingMaskIntoConstraints = false |