mirror of
https://github.com/php/php-src.git
synced 2024-11-24 02:15:04 +08:00
bd9f4fa676
For rationale, see https://github.com/php/php-src/pull/6787 Make extension checks lowercase, add a special case for opcache that has internal name not matching .so filename. Extensions migrated in part 2: * dom * exif * fileinfo * ffi
45 lines
645 B
PHP
45 lines
645 B
PHP
--TEST--
|
|
FFI 025: direct work with primitive types
|
|
--EXTENSIONS--
|
|
ffi
|
|
--INI--
|
|
ffi.enable=1
|
|
--FILE--
|
|
<?php
|
|
$x = FFI::new("int");
|
|
$x->cdata = 5;
|
|
var_dump($x);
|
|
$x->cdata += 2;
|
|
var_dump($x);
|
|
echo "$x\n\n";
|
|
unset($x);
|
|
|
|
$x = FFI::new("char");
|
|
$x->cdata = 'a';
|
|
var_dump($x);
|
|
$x->cdata++;
|
|
var_dump($x);
|
|
echo "$x\n\n";
|
|
unset($x);
|
|
?>
|
|
--EXPECTF--
|
|
object(FFI\CData:int32_t)#%d (1) {
|
|
["cdata"]=>
|
|
int(5)
|
|
}
|
|
object(FFI\CData:int32_t)#%d (1) {
|
|
["cdata"]=>
|
|
int(7)
|
|
}
|
|
7
|
|
|
|
object(FFI\CData:char)#%d (1) {
|
|
["cdata"]=>
|
|
string(1) "a"
|
|
}
|
|
object(FFI\CData:char)#%d (1) {
|
|
["cdata"]=>
|
|
string(1) "b"
|
|
}
|
|
b
|