Skip to content

Instantly share code, notes, and snippets.

View jawira's full-sized avatar
👨‍💻
Portugal. the dev

Jawira Portugal jawira

👨‍💻
Portugal. the dev
View GitHub Profile
@jawira
jawira / recursivity.php
Created September 23, 2020 09:04
Recursivity with anonymous function
<?php
namespace Jawira\Tests;
use function sleep;
function write($message): void
{
echo $message;
}
@jawira
jawira / division-multiplication.php
Created January 21, 2018 09:29
Prints basic multiplication and division, answer is introduced by user.
#!/usr/bin/env php
<?php
declare(strict_types=1);
try {
assert_options(ASSERT_ACTIVE, true);
assert_options(ASSERT_BAIL, true);
main();
} catch (Exception $e) {
die($e->getMessage());
@jawira
jawira / namespaces_and_constants.php
Last active March 15, 2016 09:25
Simple use of constants within a namespace.
<?php
/**
* Created by PhpStorm.
* User: jawira
* Date: 15.03.16
* Time: 10:03
*/
namespace Dummy\MyTime;
const MONTHS = 12;
@jawira
jawira / fibonacci.php
Last active June 20, 2019 08:27
Testing PHP7 features with Fibonacci sequence function
<?php
/**
* Succinct Fibonacci function
*
* Returns the first N Fibonacci numbers specified as parameter.
*
* This function has not been written for efficiency nor readabilty, instead it has
* been created for fun and for testing the latest PHP features (E.g.: generators,
* literal dereferencing, type hinting, short array syntax, ...).
*