Click here to Skip to main content
14,644,614 members
Rate this:
Please Sign up or sign in to vote.
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

Rate this:
Please Sign up or sign in to vote.

Solution 1

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
    $arr = ...; // declare a byte array here
    echo implode("",$arr);
?>


Regards,

Manfred
   
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, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100