How can I separate a string by characters? PHP Jquery

2

Good afternoon Titans of programming, I have a problem, I'm taking from the database a string which gives me the following value 1101000100000000 , I explain what this value is for, each character is a state 0 = Cerrado and 1 = Abierto , and at the same time these states are doors, I have a total of 16 doors that open and close, I need to separate each character to assign it to a table that I have, try to do the explode and implode in php but not have a character with which to separate it I could not, is there another way to separate it by php or do it with jquery?

    
asked by Israel Correa Quevedo 07.06.2018 в 20:56
source

2 answers

2

You can try to split it with split, this will return an array of chars with each number in a position.

$str = "Hello Friend";

$arr1 = str_split($str);
    
answered by 07.06.2018 / 20:59
source
1

I think this can help you:

for ($x = 0;$x < strlen($palabra); $x++)
{
      // Aquí se almacena cada carácter.
      $palabra[$x];
}

I hope it helps you.

Greetings.

    
answered by 07.06.2018 в 21:00