Jump to content

bitwise operator


duytin

Recommended Posts

Dear All,

 

I want to make a bitwise function but I don't know how to make it.

Suggest that I want to make function my_bitwise($a,$b). I want the result as:

Bits that are set in $a but not $b, and not vice versa.

For example: $a=1010 ; $b=1100

I want result my_bitwise($a,$b)=0010.

Pls hepl me!

Thks in advance!

Link to comment
https://forums.phpfreaks.com/topic/47696-bitwise-operator/
Share on other sites

Hi boo_lolly,

 

I'm trying to make a program this solve the Sudoku. In this programe, I use the array :

array(pow(2,1),pow(2,2),pow(2,3),pow(2,4),pow(2,5),pow(2,6),pow(2,7),pow(2,8),pow(2,9))

many times in the program. So, I want to make a constant (not a variable!) represent this array. ::)

Link to comment
https://forums.phpfreaks.com/topic/47696-bitwise-operator/#findComment-238859
Share on other sites

Hi boo_lolly,

 

I'm trying to make a program this solve the Sudoku. In this programe, I use the array :

array(pow(2,1),pow(2,2),pow(2,3),pow(2,4),pow(2,5),pow(2,6),pow(2,7),pow(2,8),pow(2,9))

many times in the program. So, I want to make a constant (not a variable!) represent this array. ::)

Link to comment
https://forums.phpfreaks.com/topic/47696-bitwise-operator/#findComment-238860
Share on other sites

For example, I want to write a PHP scrip which will:

1. Display an "0" 9X9 sudoku (default value 0 for all 81 squares).

2. The user will input some data in some squares, for example: square(1,1)=1, square(2,3)=5...

3. Transfer all 81 values of the Sudoku in an array, for example:

    for ($i=1;$i<=9;$i++)

 

Link to comment
https://forums.phpfreaks.com/topic/47696-bitwise-operator/#findComment-244041
Share on other sites

For example, I want to write a PHP scrip which will:

1. Display an "0" 9X9 sudoku (default value 0 for all 81 squares).

2. The user will input some data in some squares, for example: square(1,1)=1, square(2,3)=5...

3. Transfer all 81 values of the Sudoku in an array, for example:

    for ($i=1;$i<=9;$i++)

    {  for ($j=1;$j<=9;$j++)

        {  Sudoku[$i][$j]=square($i,$j);

        }

    }

4. After that, I will write a program to solve the Sudoku.

Link to comment
https://forums.phpfreaks.com/topic/47696-bitwise-operator/#findComment-244052
Share on other sites

the form

<form method='post'>
<?php
for ($r=0; $r<9; $r++) {
    for ($c=0; $c<9; $c++) {
        echo "<input type='text' name='sudoku[$r][$c]' size='3' value='' />";
    }
    echo '<br>';
}
echo "<input type='submit' name='action' value='Submit'>";
?>
</form>

 

Process with

 

$sudoku = $_POST['sudoku'];

Link to comment
https://forums.phpfreaks.com/topic/47696-bitwise-operator/#findComment-244134
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.