{"id":73,"date":"2007-05-25T15:45:58","date_gmt":"2007-05-25T23:45:58","guid":{"rendered":"http:\/\/hongyu.org\/wordpress\/?p=73"},"modified":"2016-08-26T21:18:02","modified_gmt":"2016-08-27T04:18:02","slug":"command-compare","status":"publish","type":"post","link":"https:\/\/www.hongyu.org\/wordpress\/?p=73","title":{"rendered":"Compare array definition in C++, Java, C#, Perl, PHP and JavaScript"},"content":{"rendered":"<p><strong>C++<\/strong><br \/>\nint arr[] = {1, 2, 3};<\/p>\n<p><strong>Java<\/strong><br \/>\nint[] arr= {1, 2, 3};<br \/>\nor\u00c2\u00a0 int arr[] = {1, 2, 3}; \/\/discouraged<\/p>\n<p><strong><a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/aa288453(VS.71).aspx\">C#<\/a><\/strong><br \/>\nint[] arr = {1, 2, 3};<\/p>\n<p><strong>Perl<\/strong><br \/>\n@arr = (1, 2, 3);<\/p>\n<p><strong>PHP<\/strong><br \/>\n$arr = array(1, 2, 3);<br \/>\nor $arr = [1, 2, 3];<\/p>\n<p>$price = array(&#8216;a&#8217;=&gt;1, &#8216;b&#8217;=&gt;2, &#8216;c&#8217;=&gt;3); # hash<\/p>\n<p><strong>JavaScript<\/strong><br \/>\nvar arr = new Array(1, 2, 3);<br \/>\nor<br \/>\nvar arr = [1,2,3];<\/p>\n<p><strong>Python<\/strong><br \/>\ntuple_var = (1, 2, 3)<br \/>\nlist_var =\u00c2\u00a0[1,2,3]<\/p>\n<p><strong>Visual Basic<\/strong><br \/>\nDim arr =\u00c2\u00a0{1,2,3}<\/p>\n","protected":false},"excerpt":{"rendered":"<p>C++ int arr[] = {1, 2, 3}; Java int[] arr= {1, 2, 3}; or\u00c2\u00a0 int arr[] = {1, 2, 3}; \/\/discouraged C# int[] arr = {1, 2, 3}; Perl @arr = (1, 2, 3); PHP $arr = array(1, 2, 3); or $arr = [1, 2, 3]; $price = array(&#8216;a&#8217;=&gt;1, &#8216;b&#8217;=&gt;2, &#8216;c&#8217;=&gt;3); # hash JavaScript var &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.hongyu.org\/wordpress\/?p=73\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Compare array definition in C++, Java, C#, Perl, PHP and JavaScript&#8221;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[2],"tags":[],"_links":{"self":[{"href":"https:\/\/www.hongyu.org\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/73"}],"collection":[{"href":"https:\/\/www.hongyu.org\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hongyu.org\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hongyu.org\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hongyu.org\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=73"}],"version-history":[{"count":3,"href":"https:\/\/www.hongyu.org\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/73\/revisions"}],"predecessor-version":[{"id":472,"href":"https:\/\/www.hongyu.org\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/73\/revisions\/472"}],"wp:attachment":[{"href":"https:\/\/www.hongyu.org\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=73"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hongyu.org\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=73"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hongyu.org\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=73"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}