Jump to content

Search the Community

Showing results for tags 'bitwise'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 2 results

  1. Hi Thanks for your help I'll just describe what I want to do any advice or if you could provide your own example it would really help, thanks again! I have a string holding hex numbers "41495ab3edde720c" and I want to get those values out of the string and represent them as hexadecimal thus 0x41495ab3edde720c, then I want to xor that hex with another hex like 0x41495ab3edde720c ^ 0x1111111111111111 then I want to take the result which will be in this example (50584BA2FCCF631D) and turn it back into a string "50584BA2FCCF631D" I'm not that good with php it seems hard to do this easily?
  2. hi all, here's some code for combinations of array values: $words = array(1,2,3,4); $num = count($words); //The total number of possible combinations $total = pow(2, $num); //Loop through each possible combination for ($i = 0; $i < $total; $i++) { //For each combination check if each bit is set for ($j = 0; $j < $total; $j++) { //Is bit $j set in $i? if (pow(2, $j) & $i) echo $words[$j] . ' '; } echo '<br />'; } I understand everything about this except the fact that the array indicies can only be 0-3 for an array with 4 elements like this one. What I'm not understanding is the nested loop for $J. Isn't it obvious that the bitwise outcome will never be = 1 everytime $J rises above 3 (which is the element count) and finishes it's loop? If the outcome was ever = 1 in that scenario, $words[$j] would be undefined and couldn't echo out, right? So the question is, why is this code written the way it is which renders most of the nested loop iterations for $J useless? If this is supposed to be in the math section, please let me know. thanks.
×
×
  • 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.