Page 3 of 4
Posted: Wed Jun 07, 2006 1:37 am
by s.dot
hmm made me go wow.
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);

Posted: Wed Jun 07, 2006 5:49 pm
by alex.barylski
always use HEREDOC syntax, especially for SQL statements. Look at the difference
Nice...never even thought of using it for SQL...
That is actually nice

Posted: Wed Jun 07, 2006 5:58 pm
by daedalus__
Everything about PHP makes me go wow. I came from ASP :- /
Posted: Wed Jun 07, 2006 6:04 pm
by RobertGonzalez
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

.
Posted: Wed Jun 07, 2006 6:26 pm
by patrikG
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.
Here was something I wrote up on that technique:
http://blog.casey-sweat.us/?p=18
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

Posted: Wed Jun 07, 2006 8:10 pm
by sweatje
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.
HTH
Posted: Wed Jun 07, 2006 10:49 pm
by seodevhead
Thank god MySQL got a FULLTEXT index. Could you imagine if we still had to use %LIKE%???

Posted: Wed Jun 07, 2006 11:26 pm
by Charles256
fulltext index? i still use like...um.... : hides : enlightenment?
Posted: Thu Jun 08, 2006 12:44 pm
by seodevhead
Charles256 wrote:fulltext index? i still use like...um.... : hides : enlightenment?
??????

Posted: Thu Jun 08, 2006 1:06 pm
by daedalus__
What's a HEREDOC syntax?
A standard?
Posted: Thu Jun 08, 2006 1:13 pm
by PrObLeM
get_meta_tags
http://www.php.net/get_meta_tags it saved me from paring html in php4
Posted: Thu Jun 08, 2006 1:29 pm
by sweatje
Daedalus- wrote:What's a HEREDOC syntax?
A standard?
Code: Select all
$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;
http://www.php.net/manual/en/language.t ... ax.heredoc
Posted: Thu Jun 08, 2006 11:40 pm
by Benjamin
Jcart wrote:Charles256 wrote:I just learned that
is a perfectly valid short cut to
I had no idea.
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.
Posted: Fri Jun 09, 2006 4:20 am
by Maugrim_The_Reaper
I don't think you can use
though. So using the short tag
needs a little more work to replace.
Posted: Fri Jun 09, 2006 10:20 am
by RobertGonzalez
Seriously though, even though you can use it doesn't mean you should. Beside, what is so hard about writing...
Code: Select all
<?php
$mydate = ( date("Y") == 2006 ) ? 'It is 2006' : 'It is a different year';
?>
<p>What year is it: <?php echo $mydate; ?></p>