This repository has been archived on 2020-06-07. You can view files and clone it, but cannot push or open issues or pull requests.
php-armadillo/tests/013-foreach.phpt

30 lines
429 B
Plaintext
Raw Normal View History

2019-08-11 18:15:06 +00:00
--TEST--
Test for method `forEach()`.
--SKIPIF--
<?php
require_once 'includes/loaded.php';
is_php_arma_loaded();
?>
--FILE--
<?php
require_once 'includes/assert.php';
$mat = Arma\IMat::fromString('1 2; 3 4');
$mat->rawPrint();
$mat->forEach(function (Arma\MapVal $elem) {
$elem_val = $elem->val();
echo $elem_val;
$elem->setTo($elem_val + 4);
});
echo PHP_EOL;
$mat->rawPrint();
?>
--EXPECT--
1 2
3 4
1324
5 6
7 8