Jump to content

.josh

Staff Alumni
  • Posts

    14,780
  • Joined

  • Last visited

  • Days Won

    43

Everything posted by .josh

  1. .josh

    Why?

    some kind of bug? echo (int) ((0.1 + 0.7) * 10); // output: 7 echo (int) ((.1 + .7) * 10); // output: 7 echo (int) ((1.1 + 0.7) * 10); // output: 18 echo (int) ((0.1 + 1.7) * 10); // output: 18 echo (int) ((1.1 + .7) * 10); // output: 18 echo (int) ((.1 + 1.7) * 10); // output: 18 echo (int) (10 * (0.1 + 0.7)); // output: 7 echo (int) 10 * (0.1 + 0.7); // output: 8 seems to be casting the first number as int and then operating.
  2. .josh

    seems so simple.

    Okay so basically what you're saying is that you're trying to find a 40 character alpha-numeric string, and you know the first 8 characters, right? $prefix = 's32dwds3'; // example prefix $string = 's32dwds3k34os098dfsnw2lknc9832lknd8h7d3y'; // example string preg_match('~'.$prefix.'(\w{32})~',$string, $match); echo $string . "<br/>"; echo $match[1];
  3. How do you select the replies for display? Just do the same thing you did there, but instead of selecting the info, just count the rows returned, using COUNT
  4. or glob
  5. I have a bot that scrapes unsolved threads and sends me a summary of the OP to my blackberry. Not really.
  6. Wildteen's code forgot $ for $num if($num >= 20 && ($num%20 == 0))
  7. Ah yes, thats how I used to do it That works apart from when $num = any of these 20,40,60,80 I need it like this Example 20 rounds to 0 40 rounds to 20 60 rounds to 40 80 rounds to 60 Any ideas to get around that issue? Hey it's your project, so you must know what you're doing. All I'm gonna say is...does 0 get rounded down to -20? So why would 20 get rounded down to 0, 40 to 20, etc...? Not necessarily arguing; just curious.
  8. you
  9. $num = floor($num/20) * 20;
  10. I was going to suggest something similar but I don't have PS so I didn't know the tool names/description or anything.
  11. redarrow I wasn't poking at your 'bad english' I was poking at your coding style.
  12. And actually, $12,480 is GROSS: pre-taxed. Depending on how you claim yourself (married, dependents), you can have up to around $25% of that taken for taxes. Oh wait wait... apparently US federal min wage just went up to a whopping $6.55/hr. And that is federal minimum wage. A lot of states have their own minimum wage. Some higher, some lower. I thought states were required to at least match federal min. but apparently not...but regardless, highest rate right now looks like $8.07/hr which is still way below what you guys get over there (most of them are between $6.50-$7). And again, that's PRE-taxed. Of course, cost of living is probably different. I pay about $3 for a gallon of milk and about $2 for a loaf of bread where I live. Prices vary from one end of the states to the other; I think I'm probably in the lower end of that spectrum... be that as it may, it's just not possible to live off of minimum wage here. I've lived all over the states, worked McJobs everywhere, lived in the poorest neighborhoods you could possibly live in, and even then, I had to make it a joint effort with several other people.
  13. wait wait wait. Are you seriously suggesting that that example code you just gave, is easier to read and understand than what's in the manual? All this time I thought you wrote like that because you just didn't know any better. Now that I know that you actually do that on purpose...man, I just don't know what to think about that...
  14. Coincidentally, I wrote a very in-depth explanation of all those. I also give a few examples, and even added a comment system so people can post clever uses or limitations of them. You can find all this at http://www.php.net/manual I even made it to where you can put for instance, http://www.php.net/array_diff and it will take you right to the page about it. And it's all for free!
  15. £20k/yr a year to flip burgers over there? That's more than twice what the USA counterpart makes. $6.00/hr * 40hr/wk * 52wk = $12,480 or £8,432 per year.
  16. yeah that does sound better. switched.
  17. My suggestion: 0+ Irregular 50+ Enthusiast 500+ Devotee 1500+ Addict 3k+ Fanatic 5k+ Freak! 10k+ 'Insane!' 15k+ 'Mind Boggling!'
  18. I am indeed 30.
  19. I'm sorry if my joking was not obvious.
  20. Didn't you know? Everybody's question is very important, and urgent, and has a deadline of tomorrow, etc.. blahblahblah.
  21. Your query is failing because your offset is a negative number. Table rows start at 0. I didn't look at the rest of your code to find out how you arrived at a negative number, but I'm assuming there's some logic bug somewhere that generates that. I'd start with how your $page is generated. Even after that, you need to further validate your $page from the GET var. Your validation is to simply assign 1 to it if it's not set. What if it's a negative number, like right now (bug in your script)? Even after you fix the bug, people can enter in negative numbers from the url and the same thing will happen. Or worse. Your script throws it directly into your query. No checking if it's a valid number in a valid range, if it's some arbitrary value, nothing. Read up on sql injection.
  22. $string = "string to replace all spaces"; $string = str_replace(" ","",$string);
  23. Unless you're using a really old version of php, there's no need to seed the random number generator for rand or shuffle or any of the other randomize type functions. function randomPassword($length = { $charlist = array_merge(range('a','z'), range('A','Z'), range(0,9), '_'); shuffle($charlist); return implode('', array_slice($charlist, 0, $length)); } // end randomPassword
  24. google wamp or xampp
  25. Back in my day, SEO was going door to door. That's another thing you kids are lazy about. Too lazy to get out and hit the streets. If you can't be bothered to even come talk to me in person, why should I bother with you? // shakes angry fist
×
×
  • 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.