30 lines
675 B
Plaintext
30 lines
675 B
Plaintext
|
--TEST--
|
||
|
Test for `Internal\Scalar`.
|
||
|
--SKIPIF--
|
||
|
<?php
|
||
|
require_once 'includes/loaded.php';
|
||
|
require_once 'includes/supports.php';
|
||
|
if (is_php_arma_loaded()) {
|
||
|
supports_operator_overloading();
|
||
|
}
|
||
|
?>
|
||
|
--FILE--
|
||
|
<?php
|
||
|
|
||
|
require_once 'includes/assert.php';
|
||
|
|
||
|
$mat = Arma\IMat::fromString('1 2; 3 4');
|
||
|
$mapval = $mat(1, 0);
|
||
|
$mapval = 5;
|
||
|
// Unfortunately, the Zend Engine prevents us from writing something like:
|
||
|
// $mat(1, 0) = 5;
|
||
|
// because function return values are not supposed to be used in write context.
|
||
|
// Function `zend_ensure_writable_variable()` does that check in compile time.
|
||
|
|
||
|
batch_assert('operator overloading of `MapVal`',
|
||
|
[5, +$mat->at(1, 0)],
|
||
|
);
|
||
|
|
||
|
?>
|
||
|
--EXPECT--
|