Historically, it used to be the case that single quotes were marginally faster – at least “moo$foobar” would be marginally slower than ‘moo’ . $foo . ‘bar’. 

 

I think in modern php, the difference between “moo” and ‘moo’ is basically the same – it goes to same opcode in lexer, and the engine has changed so the difference between the string concatentation is irrelevant

 

I tend to go towards using single quotes so it’s easier to read/count – try processing some vbscript style statement similar to ""INSERT INTO f VALUES (""""Paul""s"""",""""bar"""",foo"""")"" with some fonts :)

 

Paul

 

 

From: Roland Becker [mailto:notifications@github.com] 
Sent: 06 April 2014 19:30
To: mantisbt/mantisbt
Cc: grangeway
Subject: Re: [mantisbt] Mantis 2.0 - Database Layer Patch (#156)

 

In core/custom_field_api.php:

> @@ -831,14 +801,8 @@ function custom_field_get_value( $p_field_id, $p_bug_id ) {
>              return false;
>       }
>  
> -     $t_value_field = ( $row['type'] == CUSTOM_FIELD_TYPE_TEXTAREA ? 'text' : 'value' );
> -
> -     $t_custom_field_string_table = db_get_table( 'custom_field_string' );
> -     $t_query = "SELECT $t_value_field
> -                              FROM $t_custom_field_string_table
> -                              WHERE bug_id=" . db_param() . " AND
> -                                           field_id=" . db_param();
> -     $t_result = db_query_bound( $t_query, array( $p_bug_id, $p_field_id ) );
> +     $t_query = 'SELECT value FROM {custom_field_string} WHERE bug_id=%d AND field_id=%d';

Sometimes you replace double quotes by single quotes when building the query, sometimes not.
Is there a rule behind it?

—
Reply to this email directly or view it on GitHub <https://github.com/mantisbt/mantisbt/pull/156/files#r11327337> .