Jump to content

Alex

Staff Alumni
  • Posts

    2,467
  • Joined

  • Last visited

Everything posted by Alex

  1. This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=341844.0
  2. It's definitely doable. I've actually done that exact thing: PHP socket server and a flash client. The game I created wasn't particularly network heavy, fairly light actually, but I learned the hard way that PHP definitely isn't what you want to use for this kind of thing. I'm not sure on how many players you intend on having, but I was seeing a big performance drop as low as 8 players, and I'm sure the network wasn't the bottleneck. I didn't do much research to find specifically what was the issue in PHP (I just assumed it was something slow in the way they handled something in the socket functions), but I ended up just rewriting the server in C++. That fixed all the performance issues. It was still fun to experiment with sockets in PHP. Good luck with your project.
  3. You need to do something like: if ($month == "January" OR $month == "March" ... The way you were doing it was checking if $month == "January" or "March" which gets evaluated to true, so it's always true.
  4. It's nowhere near as simple as you make it sound. With no background in AI you're not going to be able to make a very good clone.
  5. You can read more about that and other operators here in the manual.
  6. Alex

    Firefox 6

    Well as a developer, the problem isn't just about having the latest browser/patch, but the addons actually working for it. And as a web developer, you aren't just working in a single browser (or browser version), so you don't get the option to pick the "always up-to-date" Chrome option and give everybody else the finger. I need to make sure stuff works in FF, even if Chrome is my browser of choice, you know? And therefore I heavily depend on a handful of Addons to work with it, as it makes my job 1000 times easier, arguably possible at all. I don't disagree with you, your opinion just covers more than mine did. In my limited statement I was only advocating Chrome for a general purpose browser. I was saying that the updating mechanism is useful to both users and developers, but for two different reasons: For users, they get updates, bug fixes, etc.. without having to do anything. For developers, the users are always using the most up to date version of the software.
  7. Does this happen to be inside a loop or something? I think we'll need to see more context to help.
  8. This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=341768.0
  9. Alex

    Firefox 6

    Alternatively, you could use the best web browser Chrome, and not have to worry about tedious updating because it happens in the background without you even knowing. You get updates and bug fixes without ever having to do anything. And more importantly, for us web developers, it means 99%+ of users are always using the newest version just weeks after it comes out.
  10. Alex

    Firefox 6

    I'm just going to upgrade to the numbers that are only divisible by themselves. So.. none of them? Dumb ass me as usual. I left out the word evenly...evenly divisible by themselves....1,3,5,7,11...ect. Are they called prime numbers? No, you used the word correctly. You forgot to say "..and 1" , all natural numbers have a divisor of 1. Prime numbers have only themselves and 1 as divisors.
  11. Alex

    Firefox 6

    I'm just going to upgrade to the numbers that are only divisible by themselves. So.. none of them?
  12. This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=341671.0
  13. INSERT queries shouldn't have WHERE statements. What are you trying to do? If you're trying to update a row you should be using an UPDATE query.
  14. That wouldn't work, it would only include the output of the script, not the actual script. So long as your server is configured correctly other people won't be able to get the source of your scripts that way.
  15. There's definitely a feeling empowerment. With technology being as ubiquitous as it is, there are tons of applications and opportunities to just build something useful. I think it's similar to the enjoyment that a carpenter or craftsman gets out of his work just in a different form. Just being able to build something that's useful whether it be just for a small group of my friends or for a larger audience is one of the aspects that I enjoy.
  16. You need to use the comparison operator, ==. All you're doing is setting $City equal to "New York".
  17. Technically in case like that you might not get an error, but that doesn't mean it's a good idea. Not only is it a bad idea for the reason KingPhilip pointed out, but what about when you come and look at the code later? If it's more complex than that basic example it might not be entirely clear where $mp3s is coming from and you'll be confusing yourself.
  18. http://en.wikipedia.org/wiki/Conway's_Game_of_Life It's funny that you just posted this. I was just reading chrome blog and how they implemented native client support into the current beta channel. One of the four native client examples they have is Conway's Game of Life. PHP wouldn't be the best for this probably, especially if you want to see how it unfolds step-by-step. You could create something using PHP GD and view it X steps in, or something like that. Seems like a fun idea, maybe I'll whip something up and post it.
  19. "A loop" isn't very specific, but yes, you need to initialize the array before you can use it.
  20. Take a look at array_keys. You can use that to get the keys for the elements that contain the value you're looking for, then removing them is easy.
  21. Alex

    OOP tutorial

    http://www.phpfreaks.com/forums/index.php?topic=294324.0
  22. Alex

    Sorting

    Instead of using a for loop and substr, alternatively you can take advantage of str_split, my take: function dontKnowWhatToNameThis($n) { $split = str_split($n); sort($split); return implode($split); }
  23. Whoops. That's happening because you're using sort: sort($allfamilies); Instead use asort to maintain index association.
×
×
  • 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.