
Alex
Staff Alumni-
Posts
2,467 -
Joined
-
Last visited
Everything posted by Alex
-
What's everyone been up to in the world of Programming?
Alex replied to phpSensei's topic in Miscellaneous
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. -
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.
-
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.
-
You can read more about that and other operators here in the manual.
-
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.
-
Does this happen to be inside a loop or something? I think we'll need to see more context to help.
-
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.
-
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.
-
I'm just going to upgrade to the numbers that are only divisible by themselves. So.. none of them?
-
This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=341671.0
-
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.
-
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.
-
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.
-
You need to use the comparison operator, ==. All you're doing is setting $City equal to "New York".
-
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.
-
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.
-
"A loop" isn't very specific, but yes, you need to initialize the array before you can use it.
-
array question: can you delete an entry based on it's string value?
Alex replied to php beginner's topic in PHP Coding Help
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. -
http://www.phpfreaks.com/forums/index.php?topic=294324.0
-
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); }
-
Look into AJAX.
-
Whoops. That's happening because you're using sort: sort($allfamilies); Instead use asort to maintain index association.
-
What you want to do is change this line: foreach ($allfamilies as $family) $family is an array, but you want the key of that array, so change the foreach to this: foreach ($allfamilies as $familyname => $family) Then use $familyname in the echo.