note 124520 added to ffi.new

From: Date: Wed, 18 Dec 2019 20:30:24 +0000
Subject: note 124520 added to ffi.new
Groups: php.notes 
Request: Send a blank email to php-notes+get-213553@lists.php.net to get a copy of this message
Let's assume we have a C struct: typedef struct _Z3_ast *Z3_ast; and we want to create an array: Z3_ast args[2]; and assign values: args[1] = x; args[1] = y; The PHP FFI equivalent would be: <?php $ffi = FFI::cdef(... // Create Z3_ast[2] type $arg_type = FFI::arrayType($ffi->type('Z3_ast'), [2]); // Create array of type Z3_ast[2] $args = FFI::new($arg_type); // Populate the array $args[0] = $x; $args[1] = $y; ?> ---- Server IP: 45.112.84.4 Probable Submitter: 38.142.137.34 (proxied: 130.245.32.223) ---- Manual Page -- http://php.net/manual/en/ffi.new.php Edit -- https://master.php.net/note/edit/124520 Del: integrated -- https://master.php.net/note/delete/124520/integrated Del: useless -- https://master.php.net/note/delete/124520/useless Del: bad code -- https://master.php.net/note/delete/124520/bad+code Del: spam -- https://master.php.net/note/delete/124520/spam Del: non-english -- https://master.php.net/note/delete/124520/non-english Del: in docs -- https://master.php.net/note/delete/124520/in+docs Del: other reasons-- https://master.php.net/note/delete/124520 Reject -- https://master.php.net/note/reject/124520 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#213553) next »