phpechoimplode

How can I echo implode the $result with, and on the same line, without function applied?


How can I echo implode the $result with, and on the same line, without function applied?

The code I have so far is:

else {

echo implode('<br/>', array_map('convertToBinaryString, $result));

}

which produces:

00000 00001 00011

and so on, the NOT binary variants are: 0, 1, 3, etc....

i'd like it to be printed as:

00000 is 0

00001 is 1

00011 is 3

I tried this:

echo implode('<br/>', array_map('convertToBinaryString, $result));
echo implode('<br/>', $result);

but that produces

00000

00001

00011

...

0

1

3

...


Solution

  • like so:

    foreach ($test as $t)
    { 
        echo $t."\t". bindec($t).'<br>';
    }