Click here to Skip to main content
15,881,248 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I want to know how to convert byte array to a string in php code ? Can anyone help me out ?

Thanks in advance !

[Edit: Moved on OP's behalf from non-solution]
$arr="[B@187aeca";
echo implode(" ",$arr);
?>
I tried this but it didn't work for me.
[/Edit]
Posted
Updated 7-Mar-12 4:44am
v3

1 solution

Have you tried implode yet? I have only used it with arrays of strings sofar, but you can try it out to see if it works for you.

PHP
<?php
    $arr = ...; // declare a byte array here
    echo implode("",$arr);
?>


Regards,

Manfred
 
Share this answer
 
Comments
HariniPrabhakaran 7-Mar-12 8:26am    
Hi,
I tried this sample example but it didn't work for me !

Manfred Rudolf Bihy 7-Mar-12 10:48am    
From the code you posted I can see that you did not initialize the variable $arr to a byte array. Please try again with a byte array. One more thing: Please don't ever say something like "It didn't work for me" without giving us details about what exactly did not work. Always be very specific with your questions and your replies as this will help us in helping you more quickly.

Thank you for your attention! :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900