Open xmrrabbitx opened 1 year ago
it's very odd actually. my string array is: ["trump","Biden"] . so I tried to call a function to show the candidates names as below:
contract VoteContract{ string[] public cndlist; constructor(string[] memory candidates){ candidatelist = candidates; } function cnd() public view returns(string[] memory){ return candidatelist; } }
and I called it like below:
$contract->at($address)->call("cnd", [ 'from' => $fromAccount, 'gas' => '0x200b20' ], function($err,$res){ print_r($res[0]); });
and this is the output:
Array ( [0] => � [1] => trump )
as you can see we have an odd character in index 0 instead of trump. I tested this contract on web3.js and works properly. also i tested on truffle console and has no problem.
any idea?
it's very odd actually. my string array is: ["trump","Biden"] . so I tried to call a function to show the candidates names as below:
and I called it like below:
and this is the output:
Array ( [0] => � [1] => trump )
as you can see we have an odd character in index 0 instead of trump. I tested this contract on web3.js and works properly. also i tested on truffle console and has no problem.
any idea?