I think the method for building a string array in C#
and PHP
is a little to verbose.
C#
string[] my_string_array = new string[]{ "This", "is", "ugly" };
PHP
$my_string_array = array( 'PHP', 'is', 'a', 'little', 'better' );
While I know there is insignificantly more memory usage this way is there anything really wrong with creating string arrays like this:
C#
string[] my_string_array = "This,is,ugly".Split(',');
PHP
$my_string_array = explode( ',', 'PHP,is,a,little,better' );
Any chance in the future these languages will use a simpler syntax like JavaScript?
@string_array = qw(Perl really rules)
(splits at whitespace, at compile time). – amon Mar 8 at 21:18var advice = new []{ "Take", "it", "or", "leave", "it" };
? – Leonid Mar 8 at 21:38camelCase
, not underscores. – svick Mar 8 at 22:36