Ye' old general discussion board. Basically, for everything that isn't covered elsewhere. Come here to shoot the breeze, shoot your mouth off, or whatever suits your fancy. This forum is not for asking programming related questions.
Just PHP in general As my first programming language I still get excited every now and then at the things it's capable of. This board makes me go wow. So many members with so many great projects and so much knowledge. Errm, the implementation of classes make me go wow. Learning standards make me go wow.... i can add more later.. after I think for a bit.
[edit]echo str_replace('wow','whoa',$myPost);
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
I feel you. The first 'programming' I ever did outside of HTML was PHP. When my department needed some development done I said I'd do it not knowing that the preferred platform is all Windows. Talk about a culture shock. ASP sucked (C#.NET is pretty neat, but that is for another discussion). Anyway, I learned what I needed to, but it hurt my stomach .
sweatje wrote:One technique I use sometimes is to create a Monostate object by binding a varaible to a key in one of the PHP SuperGlobals. For example, if I want a queue of notifications, I might bind an attribute to a key in the $_SESSION array and then any instance of that class can add to, or display and clear, the queue.
Interesting idea. Conceptually makes sense for a multi-user app, but that's true for any global. As a matter of fact, it is, as you say, a global by sneak. And given that singletons have recently gotten such a bad name... oooh I've never really understood the reason why they were suddenly bad, seems more like a fashion. One day they're in, the next they're out.
"Breaks the unit tests" I read somewhere. No idea, to be honest, but if that's so, write a better unit test program, guys.
I like your idea, but you can really only get away with that if you know what you're doing - and most people don't
patrikG wrote:
"Breaks the unit tests" I read somewhere. No idea, to be honest, but if that's so, write a better unit test program, guys.
It does not "break the tests", it hard codes a dependency into your code, which in turn increases the coupling and make the testing harder. It not the testing which is broken, it is the design of the code being tested. Designing code using a test first habit leads to "highly cohesive, loosely coupled" designs. The Singleton is thus an impediment to this goal, hence it's evil reputation.
$str = <<<GO_TIL_YOU_SEE_ONE_OF_THESE
This is a HEREDOC string.
It can be multiline,
contain both " and ' quotes
and supports $variable substitution
GO_TIL_YOU_SEE_ONE_OF_THESE;
What happens when short tags arn't enabled? I've heard several horror stories when porting large projects to a new host to find out their code no longer works.
Find and Replace <? to <?php ? I wouldn't think it would be a show stopper.