webhost dosnet have php5 :-(
any other ideas?
Main Topics
Browse All TopicsI have an 8 bit binary var that I want to split up into 8 seperate vars.
I figured explode() would be the best way but i guess not as i found out. How would i go about spliting this 8 bit string up?
im not a php expert :-(
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
sorry
maybe you should try this out
checkout the link below
http://php.bieffe.org/manu
$str = '01010101';
$str{0} .. $str{1} .. and so on to get each character
hope this really help
cheers
This little function will convert any string into an array of characters:
function stringtochars($string) {
$chars = array();
for ($i = $j = strlen($string); $i-->0;) $chars[--$j] = $string[$i];
return $chars;
}
It looks a little weird, but it is probably one of the fastest non-native method ways of achieving a string split. Regular expressions work fine, but can be slow if they are called a lot.
Pete
...you can, of course, just access the string directly using brackets or braces. Strings behave rather like arrays of characters under PHP.
If you want to create completely separate variables (rather than an array) from the original string, then just use the function like this...
list($bit1, $bit2, $bit3, $bit4, $bit5, $bit6, $bit7, $bit8) = stringtochars($binary);
Pete
Business Accounts
Answer for Membership
by: blue_hunterPosted on 2005-10-24 at 23:14:49ID: 15152312
try to use
en/functio n.str-spli t.php
str_split(); instead of explode()
for further information.. checkout
http://uk2.php.net/manual/
example:
$binary = "01010101";
$arr = str_split($binary);
$arr[0]..$arr[1] .. and so on to retrieve each character/number
hope this help.
cheers