Created
March 30, 2015 16:03
-
-
Save DASPRiD/937475489456c7c90dfd to your computer and use it in GitHub Desktop.
PHP vectors
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 | |
$intVector = Vector<int>(53, 32, 43); | |
$stringVector = Vector<string>('foo', 'bar', 'baz'); | |
$arrayVector = Vector<array>(array('a'), array('b')); | |
$vectorVector = Vector<Vector<int>>(Vector<int>(1, 2), Vector<int>(2, 3)); | |
$classVector = Vector<\stdClass>(new \stdClass(), new \stdClass()); | |
foreach ($intVector as $key => $value) { | |
// Do something. | |
} | |
function foo(Vector<int> $values) | |
{ | |
// May support lazy conversion of arrays into vector | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment