Difference between revisions of "Talk:Coding"

Jump to: navigation, search
m (Using clone())
(Single vs Double quotes)
Line 6: Line 6:
  
 
Unless I'm mistaken, there are some cases where we should use Moodle's full_clone() method. Maybe someone could clarify this...
 
Unless I'm mistaken, there are some cases where we should use Moodle's full_clone() method. Maybe someone could clarify this...
 +
 +
== Single vs Double quotes ==
 +
 +
According to the PHP.net manual page referenced, the memory usage issue for strings is not with single v double quotes, but with parsed variables in strings vs concatenated variables in strings.
 +
 +
As a PHP developer, I find it is overall much better to use double quotes for strings if for no other reason than that you can stick newlines (\n) in. Putting newlines in makes HTML debugging MUCH easier.
 +
 +
Just my $0.02.
 +
 +
Thanks!

Revision as of 16:24, 12 March 2008

Single quotes vs. double quotes: no noticable speed differences...

As PHP 4.3.0 is now the minimum version, the speed issue of single quotes vs. double quotes is negligible. See http://phplens.com/lens/php-book/optimizing-debugging-php.php, under "Useless Optimizations". There might be other reasons, however. I like to use "". ' is more convinient if a string has a lot of "s it it, like 'I have no "issues" with the "quotations"'. --Samuli Karevaara 04:26, 10 October 2006 (CDT)

Using clone()

Unless I'm mistaken, there are some cases where we should use Moodle's full_clone() method. Maybe someone could clarify this...

Single vs Double quotes

According to the PHP.net manual page referenced, the memory usage issue for strings is not with single v double quotes, but with parsed variables in strings vs concatenated variables in strings.

As a PHP developer, I find it is overall much better to use double quotes for strings if for no other reason than that you can stick newlines (\n) in. Putting newlines in makes HTML debugging MUCH easier.

Just my $0.02.

Thanks!