README.md
This commit is contained in:
parent
bac5cc8c31
commit
cf9ac42696
17
README.md
17
README.md
@ -176,6 +176,23 @@ $contract->bytecode($bytecode)->estimateGas($params, $callback);
|
|||||||
$contract->bytecode($bytecode)->estimateGas($functionName, $params, $callback);
|
$contract->bytecode($bytecode)->estimateGas($functionName, $params, $callback);
|
||||||
```
|
```
|
||||||
|
|
||||||
|
# Assign value to outside scope(from callback scope to outside scope)
|
||||||
|
Due to callback is not like javascript callback,
|
||||||
|
if we need to assign value to outside scope,
|
||||||
|
we need to assign reference to callback.
|
||||||
|
```
|
||||||
|
$newAccount = '';
|
||||||
|
|
||||||
|
$web3->personal->newAccount('123456', function ($err, $account) use (&$newAccount) {
|
||||||
|
if ($err !== null) {
|
||||||
|
echo 'Error: ' . $err->getMessage();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$newAccount = $account;
|
||||||
|
echo 'New account: ' . $account . PHP_EOL;
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
# Examples
|
# Examples
|
||||||
|
|
||||||
To run examples, you need to run ethereum blockchain local (testrpc).
|
To run examples, you need to run ethereum blockchain local (testrpc).
|
||||||
|
Loading…
Reference in New Issue
Block a user