If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Oh, hey guys, I was wondering: Where can I find information about how to do PHP programming projects with multiple programmers? I've always coded by myself, but I might have some other programmers helping me in the near future. I have no idea how to work with other programmers =\

Threads are one of several technologies that make it possible to execute multiple code paths concurrently inside a single application. Although newer technologies such as operation objects and Grand Central Dispatch (GCD) provide a more modern and efficient infrastructure for implementing concurrency, OS X and iOS also provide interfaces for creating and managing threads.

After connecting to your DB and before doing anything else, submit this query:

Code:

SET NAMES 'utf8' COLLATE 'utf8_unicode_ci'

This lets MySQL know you'll be "talking UTF-8" to it from this point on in the session. Since the MySQL "real" escape functions in PHP actually call the MySQL DB's API, that should take care of it for you.

Of course, if you're using MySQLi, you should seldom, if ever, need to use the PHP escape function, since you're using prepared statements with bound parameters, right?

"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation

#2 I'm torn on whether to use prepared statements or not. Some people tell me they can't live without them, others tell me they hate them because they're slower than regular queries. In the past I have had problems with slow queries bogging down my server (I was not using prepared statements) and that experience has left me speed-conscious. So, currently I am leaning away from prepared statements. However, if you would like to argue in favor of me using prepared statements, I will consider what you say.

#1: If you can modify the MySQL config to default to those settings, then no. It's very low overhead, though.

#2: We use prepared statements all the time at work (via PDO connecting to a PostgreSQL DB), and I have no evidence it's a noticeable performance bottleneck (if at all). Poorly configured tables (in particular with regard to proper use of indexes) and inefficient SQL will be a much, much, much bigger issue. I believe in coding first for clarity, maintainability, re-usability, and security; not worrying about a millisecond here and a microsecond there (hardware is fast and relatively cheap these days). Don't worry unduly about optimization* until you know you have a problem, and then address it by testing and metering to find out where the primary issues are and addressing them then.
__________
* Yes, you want to avoid obviously stupid things like foreach() loops that repeat the same query over and over when you could do it with one query instead. When you see optimization opportunities that do not conflict unduly with your other coding objectives, then by all means use them -- but also be aware there is a lot of questionable info out there about how inefficient one technique is over another, often not supported with any empirical measurements

"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation

#1 Has PHP's implementation of regular expressions changed since 2007?

#2 I know somebody who is learning to do regular expressions with preg_match(). I would like to link her to a tutorial that I used in the past and found easy to follow. However, it was written in 2007. This is it: http://weblogtoolscollection.com/regex/regex.php Does anything jump out at you as outdated or inaccurate?