PHP

#explode

explode($delimiter, $string);

https://secure.php.net/manual/en/function.explode.php

#implode/join

implode($glue, $pieces);

https://secure.php.net/manual/en/function.implode.php https://secure.php.net/manual/en/function.join.php

#Simple Assert

$input = "a b c d e";

function main($input) {
  ...
}

function assert($expected, $input) {
  var_dump($input);
  $actual = main($input);
  $result = $expected === $actual;
  var_dump($result);
  if (!$result) {
    var_dump($actual);
    var_dump($expected);
  }
}

// Case 1
assert($expected, $input);

// Case 2
assert($expected2, $input2);

// Case 3
assert($expected3, $input3);

#Alternatives

#Cons

  • Primarily server model
  • Requires a lot of boiler plate code
  • No lambdas
  • No first class enums
  • Not asynchronous by default
  • Loosely typed (but getting better)