{"id":763,"date":"2023-04-06T20:03:18","date_gmt":"2023-04-06T12:03:18","guid":{"rendered":"https:\/\/heoffice.com\/?p=763"},"modified":"2023-04-25T22:13:02","modified_gmt":"2023-04-25T14:13:02","slug":"python-vs-php","status":"publish","type":"post","link":"https:\/\/heoffice.com\/?p=763","title":{"rendered":"Python VS PHP"},"content":{"rendered":"<figure>\n<table>\n<tbody>\n<tr>\n<td><\/td>\n<td><\/td>\n<td>Python sample<\/td>\n<td>PHP sample<\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td><\/td>\n<td><code class=\"EnlighterJSRAW\" data-enlighter-language=\"python\">#!\/usr\/bin\/python3<\/code><\/td>\n<td><code class=\"EnlighterJSRAW\" data-enlighter-language=\"php\">&lt;?php<\/code><\/td>\n<\/tr>\n<tr>\n<td>Var<\/td>\n<td>String<\/td>\n<td>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\">a = \"\"\na = ''\na = \"\"\"line1\nline2\"\"\"<\/pre>\n<\/td>\n<td>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"php\">$a = \"\";\n$a = '';\n$a = \"line1\nline2\";<\/pre>\n<\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td>Number<\/td>\n<td>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\">a = 1\nb=1.0<\/pre>\n<\/td>\n<td>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">$a = 1;<\/pre>\n<\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td>List<\/td>\n<td>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">a=[1,2,3]<\/pre>\n<\/td>\n<td>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">$a = [1,2,3];\n$a = array(1,2,3);<\/pre>\n<\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td>Tuple<\/td>\n<td>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">a=(1,\"2\")<\/pre>\n<\/td>\n<td>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">$a = [1,\"2\"];<\/pre>\n<\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td>Set<\/td>\n<td>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">a={'a','b','c'}<\/pre>\n<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td>Dictionary<\/td>\n<td>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">a={\"a\":\"aa\",\"b\":\"bb\"}<\/pre>\n<\/td>\n<td><code class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">$a = ['a'=&gt;'aa','b'=&gt;'bb']<\/code><\/td>\n<\/tr>\n<tr>\n<td>Flow<\/td>\n<td>if<\/td>\n<td>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\">if a==1 :\n\u00a0 print(\"a=1\")\nelif a==2 :\n\u00a0 print(\"a=2\")\nelse :\n\u00a0 print(\"a != 1, a != 2\")\n\n<\/pre>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\">txt = \"The best things in life are free!\"\nif \"expensive\" not in txt:\n  print(\"No, 'expensive' is NOT present.\")<\/pre>\n<\/td>\n<td>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"php\">if ($a==1)\n\u00a0 print(\"a=1\");\nelse if ($a==2)\n\u00a0 print(\"a=2\");\nelse\n\u00a0 print(\"a != 1, a != 2\");<\/pre>\n<\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td>for<\/td>\n<td>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\">for x in \"banana\":\n  print(x)<\/pre>\n<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td>while<\/td>\n<td><\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>Function<\/td>\n<td>type<\/td>\n<td>type(a)<\/td>\n<td>gettype($a);<\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td>\u00a0isinstance<\/td>\n<td>\u00a0isinstance(a,int)<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td>\u00a0delete var<\/td>\n<td>\u00a0del a<\/td>\n<td>\u00a0unset($a)<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/figure>\n","protected":false},"excerpt":{"rendered":"<p>Python sample PHP sample #!\/usr\/bin\/python3 &lt;?php Va&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"elementor_header_footer","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-763","post","type-post","status-publish","format-standard","hentry","category-web"],"acf":[],"_links":{"self":[{"href":"https:\/\/heoffice.com\/index.php?rest_route=\/wp\/v2\/posts\/763","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/heoffice.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/heoffice.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/heoffice.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/heoffice.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=763"}],"version-history":[{"count":55,"href":"https:\/\/heoffice.com\/index.php?rest_route=\/wp\/v2\/posts\/763\/revisions"}],"predecessor-version":[{"id":880,"href":"https:\/\/heoffice.com\/index.php?rest_route=\/wp\/v2\/posts\/763\/revisions\/880"}],"wp:attachment":[{"href":"https:\/\/heoffice.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=763"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/heoffice.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=763"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/heoffice.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=763"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}