Hex2bin add in array using php

i used bin2hex some code and get code
i also used hex2bin but when i used array error show
how can used hex2bin in array
for example

$str = '"C"=>"cccccccccccc"';
$getcodebin = bin2hex($str);

result this
2243223d3e2263636363636363636363636322
i used this code

$arraycode = hex2bin($getcodebin);
$findresult = "C";
$arr = array($arraycode);
echo $arr[$findresult]."<br>";

but when run this code on browser error show
Undefined index: C in
how can used and get result help me

That is a string not an array. Why does it have quotes?

I don’t see what you are actually trying to do at all with what you posted.

i hide some code and show bin code
but when run script bin code run actually change php code and result show

$findresult = "C";
$arr = array("C"=>"cccccccccccc");
echo $arr[$findresult]."<br>";
...
i change these code in bin ( "C"=>"cccccccccccc" )

hex2bin/bin2hex work on strings, so you have to find a string representation of your array, you can use json_encode()/json_decode(), or var_export() for that, just have some tests on the intermediate results, because json_encode()/json_decode() will handle your array as an object.

Give the example of json_encode()/json_decode() , or var_export()
thanks

just read it up the manual and try yourself

http://php.net

Sponsor our Newsletter | Privacy Policy | Terms of Service