Jump to content

HardCoreMore

Members
  • Posts

    71
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

HardCoreMore's Achievements

Member

Member (2/5)

0

Reputation

  1. Hey man, Thanks for this. It just helped me. I was using wamp and i went to wamp options in tray bar on windows and enable socket extension and had the same issue as you. Now when i saw this post i went to wamp/bin/php/php5.3.4/ only to discover the socket extension is still commented. So i uncommented it and now it works
  2. hahahahah thanks preg_match_all() hahahha thanks i would never guessed it thank you
  3. Hi all, Why i can't get all the a's and their indexes. This is the script: $s1 = "a a vvvaaa sdfdsaaa ffss afdsaaaaa"; $t = preg_match( '/(a*)/i', $s1, $m, PREG_OFFSET_CAPTURE ); echo '<pre>'; print_r( $m ); echo '</pre>'; This is what i get: Array ( [0] => Array ( [0] => a [1] => 0 ) [1] => Array ( [0] => a [1] => 0 ) ) I am getting just the first a at index 0 twice
  4. See the PHP online documentation for break So in your case it would be: for( $i = 0; $i < 10; $i++ ) { switch( $i ) { case 1: break; case 2: // break from loop here break 2; case 3: break; } } Thanks!
  5. Is there a way to stop loop inside a switch or i must use if instead of switch? Example: <?php for( $i = 0; $i < 10; $i++ ) { switch( $i ) { case 1: break; case 2: // break from loop here break; case 3: break; } } ?> Thanks
  6. Thanks johny. Now i understand both what i actually wanted and how to accomplish it. Yes that helps. Thank you. Yes i know that is why i asked it that way. No, it will work on a stream of bytes (a byte has 8 bits) Thank you. This was helpful. Now it makes sense. Without a detail explanation, or code snippets your questions are vague and generalized, so u will get answers based on what ppl assume you want. Yes i know. I asked that way because i myself didn't know what i what exactly nor what to ask exactly because i never done such things before and that is why i asked such question so that i can see what people saying so i can learn what i don't know and to be able to ask right question. You got to have some knowledge in the first place to be able to ask right question. So i needed that. Sorry if i bugged anyone. that all really depends what yer operations are on your data if yer doing a simple bitflags system, than u dont need a whole lot just Get/Set/Clear/Toggle Bit functions. if your were say encrypting than u need to convert the stream into char/ints. But all these really needs a clear explanation of what yer trying to accomplish This was also helpful. Thank you. Thanks all. Now things are a lot clearer.
  7. I forgot something. The reason i asked this is that i didn't quite understand how fopen and opening files generally work. So it is necessary to loop through string to convert it to binary like this: for($i = 0; $i < strlen($string); $i++) { $out .= base_convert(ord($string[$i]), 10, 2); } can fopen open it in a stream of zeros and ones. And one more thing. Is it possible to do calculations on big binary at once. For example when i do 1010 & 1111 that is equal 1010 obviously. But how can i do such operations on big raw values. For example php int are 32 bit and can hold signed values for about 2 billion as specified in documentation. If i give it big raw binary number that will not work. On the other hand if i use string to make binary how can i than use bitwise operators. I am not clear about how to achieve this. if i have raw binary number that is( i will represent it in decimal to spare the room ) 100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 so i can't assign this number to php var because its to big. if i convert it to STRING OF BINARY ONES AND ZEROS how can i then apply bitwise operations on string? Hope you understand what i am trying to do here if that is possible and make sense. Thanks If you can't operate on big values at once than what is workaround
  8. Thanks johny. That was exactly that i was looking for. Although i read on php.net that base_convert has some problems with big numbers but that is not a problem here since characters are 8 bit. Thanks again
  9. Hey johnny86, Thanks for the reply. But i can't figure out what phps unpack function is doing. Can you elaborate that a little please.
  10. Hi all, Is it possible in php to read data from file as binary and operate on it with bitwise operators and save result as binary. Thanks
  11. Hi Guys, @requinix, @salathe Thanks for your reply. @salathe I am reading it second time already. I understand it for the most part but not quite complete yet. Probably will read it one more time to understand it completely. But there is something they said there that i don't know the reason for. Qute "The maximum number of captured substrings is 99, and the maximum number of all subpatterns, both capturing and non-capturing, is 200. " Does anyone knows why is there a limit to number of captured substrings and subpattenrs? What i have a really big text file or multiple text files combined that i want to test regex on? Thanks!
  12. ok do you think that is a good thing that they used procedural or they be better now if they used OOP
  13. ok what are those "the biggest programming projects". just named them so i can know what are you talking about
  14. I'm not sure you guys have that ability, that is my entire point. try me
  15. thorpe its you still don't understand. its not important if we are OOP fanboys or not. still not contributing to conversation. lets talk about OOP vs procedural and we may learn something instead poking each other eyes The answer to the original question obviously needs to take into account the users abilities. well the users abilities can change. don't you think so?
×
×
  • 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.