{"id":315,"date":"2016-03-31T15:10:37","date_gmt":"2016-03-31T06:10:37","guid":{"rendered":"http:\/\/www.onepage.co.kr\/wordpress\/?p=315"},"modified":"2017-01-17T00:15:45","modified_gmt":"2017-01-16T15:15:45","slug":"asp-php-conversion","status":"publish","type":"post","link":"https:\/\/www.onepage.co.kr\/wordpress\/index.php\/2016\/03\/31\/asp-php-conversion\/","title":{"rendered":"asp <-> php \uc0c1\ud638 \ubcc0\ud658"},"content":{"rendered":"<div id=\"cContent\">\n<div id=\"contentDiv\" class=\"cContentBody\">\n<table class=\"gray1\" border=\"0\" width=\"720\" cellspacing=\"1\" cellpadding=\"3\">\n<tbody>\n<tr>\n<td colspan=\"2\"><b>General syntax<\/b><\/td>\n<\/tr>\n<tr>\n<td class=\"ht1\" valign=\"top\">\n<dl class=\"t2\">\n<dt>ASP Comments, inline<\/dt>\n<dd><code><span style=\"font-family: \uad74\ub9bc\uccb4;\">'my dog has fleas<\/span><\/code><\/dd>\n<\/dl>\n<\/td>\n<td class=\"ht2\" valign=\"top\">\n<dl class=\"t2\">\n<dt>PHP Comments, inline<\/dt>\n<dd><code><span style=\"font-family: \uad74\ub9bc\uccb4;\">\/\/my dog has fleas<\/span><\/code><\/dd>\n<\/dl>\n<\/td>\n<\/tr>\n<tr>\n<td class=\"ht1\" valign=\"top\">\n<dl class=\"t2\">\n<dt>ASP Comments, block<\/dt>\n<dd><code><br \/>\n<span style=\"font-family: \uad74\ub9bc\uccb4;\">not available?<\/span><\/code><\/dd>\n<\/dl>\n<\/td>\n<td class=\"ht2\" valign=\"top\">\n<dl class=\"t2\">\n<dt>PHP Comments, block<\/dt>\n<dd><code><span style=\"font-family: \uad74\ub9bc\uccb4;\">\/*<br \/>\nThe quick brown fox<br \/>\njumped over the lazy dogs.<br \/>\n*\/<\/span><\/code><\/dd>\n<\/dl>\n<\/td>\n<\/tr>\n<tr>\n<td class=\"ht1\" valign=\"top\">\n<dl class=\"t2\">\n<dt>ASP, Escaping quotes<\/dt>\n<dd><code><span style=\"font-family: \uad74\ub9bc\uccb4;\">\"\"<\/span><\/code><\/p>\n<p>&#8220;var text1=&#8221;&#8221;&lt;img src=\\&#8221;&#8221;blank.gif\\&#8221;&#8221;&gt;&#8221;&#8221;;&#8221;<\/dd>\n<\/dl>\n<\/td>\n<td class=\"ht2\" valign=\"top\">\n<dl class=\"t2\">\n<dt>PHP, Escaping quotes<\/dt>\n<dd><code><span style=\"font-family: \uad74\ub9bc\uccb4;\">\\\" or use ' like javascript<\/span><\/code><\/p>\n<p>&#8216;var text1=&#8221;&lt;img src=\\&#8221;blank.gif\\&#8221;&gt;&#8221;;&#8217;;<\/dd>\n<\/dl>\n<\/td>\n<\/tr>\n<tr>\n<td class=\"ht1\" valign=\"top\">\n<dl class=\"t2\">\n<dt>ASP Command termination<\/dt>\n<dd><code><span style=\"font-family: \uad74\ub9bc\uccb4;\">None, but only one command per line.<br \/>\n<\/span><\/code><\/dd>\n<\/dl>\n<\/td>\n<td class=\"ht2\" valign=\"top\">\n<dl class=\"t2\">\n<dt>PHP Command termination<\/dt>\n<dd><code><span style=\"font-family: \uad74\ub9bc\uccb4;\">Each command must end with ; but<br \/>\nmultiple commands per line are allowed.<\/span><\/code><\/dd>\n<\/dl>\n<\/td>\n<\/tr>\n<tr>\n<td class=\"ht1\" valign=\"top\">\n<dl class=\"t2\">\n<dt>ASP Screen output<\/dt>\n<dd><code><span style=\"font-family: \uad74\ub9bc\uccb4;\">response.write \"hello\"<br \/>\n<\/span><\/code><\/dd>\n<\/dl>\n<\/td>\n<td class=\"ht2\" valign=\"top\">\n<dl class=\"t2\">\n<dt>PHP Screen output<\/dt>\n<dd><code><span style=\"font-family: \uad74\ub9bc\uccb4;\">echo \"hello\";<br \/>\n<\/span><\/code><\/dd>\n<\/dl>\n<\/td>\n<\/tr>\n<tr>\n<td class=\"ht1\" valign=\"top\">\n<dl class=\"t2\">\n<dt>ASP Newline characters<\/dt>\n<dd><code><span style=\"font-family: \uad74\ub9bc\uccb4;\">vbCrLf<\/span><\/code><\/p>\n<p>response.write &#8220;hello&#8221; &amp; vbCrLf<\/dd>\n<\/dl>\n<\/td>\n<td class=\"ht2\" valign=\"top\">\n<dl class=\"t2\">\n<dt>PHP Newline characters<\/dt>\n<dd><code><span style=\"font-family: \uad74\ub9bc\uccb4;\">\"\\n\" (must be inside \"\", not '')<\/span><\/code><\/p>\n<p>echo &#8220;hello \\n&#8221;;<\/dd>\n<\/dl>\n<\/td>\n<\/tr>\n<tr>\n<td class=\"ht1\" valign=\"top\">\n<dl class=\"t2\">\n<dt>ASP Variable Names<\/dt>\n<dd><code><span style=\"font-family: \uad74\ub9bc\uccb4;\">Not case sensitive,<br \/>\nso fName is the same as FNAME<\/span><\/code><\/dd>\n<\/dl>\n<\/td>\n<td class=\"ht2\" valign=\"top\">\n<dl class=\"t2\">\n<dt>PHP Variable Names<\/dt>\n<dd><code><span style=\"font-family: \uad74\ub9bc\uccb4;\">Case sensitive AND must begin with $<br \/>\nso $fName is NOT the same as $FNAME<\/span><\/code><\/dd>\n<\/dl>\n<\/td>\n<\/tr>\n<tr>\n<td colspan=\"2\"><b>String Functions<\/b><\/td>\n<\/tr>\n<tr>\n<td class=\"ht1\" valign=\"top\">\n<dl class=\"t2\">\n<dt>ASP String concatenation<\/dt>\n<dd><code><span style=\"font-family: \uad74\ub9bc\uccb4;\">&amp;<\/span><\/code><\/p>\n<p>fname=name1 &amp; &#8221; &#8221; &amp; name2<br \/>\nemsg=emsg &amp; &#8220;error!&#8221;<\/dd>\n<\/dl>\n<\/td>\n<td class=\"ht2\" valign=\"top\">\n<dl class=\"t2\">\n<dt>PHP String concatenation<\/dt>\n<dd><code><span style=\"font-family: \uad74\ub9bc\uccb4;\">. and .=<\/span><\/code><\/p>\n<p>$fname=$name1.&#8221; &#8220;.$name2;<br \/>\n$emsg.=&#8221;error!&#8221;;<\/dd>\n<\/dl>\n<\/td>\n<\/tr>\n<tr>\n<td class=\"ht1\" valign=\"top\">\n<dl class=\"t2\">\n<dt>ASP, Change case<\/dt>\n<dd><code><span style=\"font-family: \uad74\ub9bc\uccb4;\">LCase(), UCase()<\/span><\/code><\/p>\n<p>lowerName=LCase(chatName)<br \/>\nupperName=UCase(chatName)<\/dd>\n<\/dl>\n<\/td>\n<td class=\"ht2\" valign=\"top\">\n<dl class=\"t2\">\n<dt>PHP, Change case<\/dt>\n<dd><code><span style=\"font-family: \uad74\ub9bc\uccb4;\">strtolower(), strtoupper()<\/span><\/code><\/p>\n<p>$lowerName=strtolower($chatName);<br \/>\n$upperName=strtoupper($chatName);<\/dd>\n<\/dl>\n<\/td>\n<\/tr>\n<tr>\n<td class=\"ht1\" valign=\"top\">\n<dl class=\"t2\">\n<dt>ASP String length<\/dt>\n<dd><code><span style=\"font-family: \uad74\ub9bc\uccb4;\">Len()<\/span><\/code><\/p>\n<p>n=Len(chatName)<\/dd>\n<\/dl>\n<\/td>\n<td class=\"ht2\" valign=\"top\">\n<dl class=\"t2\">\n<dt>PHP String length<\/dt>\n<dd><code><span style=\"font-family: \uad74\ub9bc\uccb4;\">strlen()<\/span><\/code><\/p>\n<p>$n=strlen($chatName);<\/dd>\n<\/dl>\n<\/td>\n<\/tr>\n<tr>\n<td class=\"ht1\" valign=\"top\">\n<dl class=\"t2\">\n<dt>ASP, Trim whitespace<\/dt>\n<dd><code><span style=\"font-family: \uad74\ub9bc\uccb4;\">Trim()<\/span><\/code><\/p>\n<p>temp=Trim(xpage)<\/dd>\n<\/dl>\n<\/td>\n<td class=\"ht2\" valign=\"top\">\n<dl class=\"t2\">\n<dt>PHP, Trim whitespace<\/dt>\n<dd><code><span style=\"font-family: \uad74\ub9bc\uccb4;\">trim() and also ltrim(), rtrim()<\/span><\/code><\/p>\n<p>$temp=trim($xpage);<\/dd>\n<\/dl>\n<\/td>\n<\/tr>\n<tr>\n<td class=\"ht1\" valign=\"top\">\n<dl class=\"t2\">\n<dt>ASP String sections<\/dt>\n<dd>\n<pre>Left(), Right(), Mid()\r\n\r\nLeft(\"abcdef\",3)      result = \"abc\"\r\nRight(\"abcdef\",2)     result = \"ef\"\r\nMid(\"abcdef\",3)       result = \"cdef\"\r\nMid(\"abcdef\",2,4)     result = \"bcde\"<\/pre>\n<\/dd>\n<\/dl>\n<\/td>\n<td class=\"ht2\" valign=\"top\">\n<dl class=\"t2\">\n<dt>PHP String sections<\/dt>\n<dd>\n<pre>substr()\r\n\r\nsubstr(\"abcdef\",0,3);     result = \"abc\"\r\nsubstr(\"abcdef\",-2);      result = \"ef\"\r\nsubstr(\"abcdef\",2);       result = \"cdef\"\r\nsubstr(\"abcdef\",1,4);     result = \"bcde\"<\/pre>\n<\/dd>\n<\/dl>\n<\/td>\n<\/tr>\n<tr>\n<td class=\"ht1\" valign=\"top\">\n<dl class=\"t2\">\n<dt>ASP String search forward, reverse<\/dt>\n<dd>\n<pre>Instr(), InstrRev()\r\n\r\nx=Instr(\"abcdef\",\"de\")        x=4 \r\nx=InstrRev(\"alabama\",\"a\")     x=7<\/pre>\n<\/dd>\n<\/dl>\n<\/td>\n<td class=\"ht2\" valign=\"top\">\n<dl class=\"t2\">\n<dt>PHP String search forward, reverse<\/dt>\n<dd>\n<pre>strpos(), strrpos()\r\n\r\n$x=strpos(\"abcdef\",\"de\");      x=3\r\n$x=strrpos(\"alabama\",\"a\");     x=6<\/pre>\n<\/dd>\n<\/dl>\n<\/td>\n<\/tr>\n<tr>\n<td class=\"ht1\" valign=\"top\">\n<dl class=\"t2\">\n<dt>ASP String replace<\/dt>\n<dd><code><span style=\"font-family: \uad74\ub9bc\uccb4;\">Replace(<i>string exp,search,replace<\/i>)<\/span><\/code><\/p>\n<p>temp=Replace(temp,&#8221;orange&#8221;,&#8221;apple&#8221;)<br \/>\ntemp=Replace(temp,&#8221;&#8216;&#8221;,&#8221;\\'&#8221;)<br \/>\ntemp=Replace(temp,&#8221;&#8221;&#8221;&#8221;,&#8221;\\&#8221;&#8221;&#8221;)<\/dd>\n<\/dl>\n<\/td>\n<td class=\"ht2\" valign=\"top\">\n<dl class=\"t2\">\n<dt>PHP String replace<\/dt>\n<dd><code><span style=\"font-family: \uad74\ub9bc\uccb4;\">str_replace(<i>search,replace,string exp<\/i>)<\/span><\/code><\/p>\n<p>$temp=str_replace(&#8220;orange&#8221;,&#8221;apple&#8221;,$temp); $temp=str_replace(&#8220;&#8216;&#8221;,&#8221;\\\\'&#8221;,$temp);<br \/>\n$temp=str_replace(&#8220;\\&#8221;&#8221;,&#8221;\\\\\\&#8221;&#8221;,$temp);<\/dd>\n<\/dl>\n<\/td>\n<\/tr>\n<tr>\n<td class=\"ht1\" valign=\"top\">\n<dl class=\"t2\">\n<dt>ASP, split a string into an array<\/dt>\n<dd>\n<pre>Split()\r\n\r\ntemp=\"cows,horses,chickens\"\r\nfarm=Split(temp,\",\",-1,1)  \r\nx=farm(0)<\/pre>\n<\/dd>\n<\/dl>\n<\/td>\n<td class=\"ht2\" valign=\"top\">\n<dl class=\"t2\">\n<dt>PHP, split a string into an array<\/dt>\n<dd>\n<pre>explode()\r\n\r\n$temp=\"cows,horses,chickens\";\r\n$farm=explode(\",\",$temp);\r\n$x=$farm[0];<\/pre>\n<\/dd>\n<\/dl>\n<\/td>\n<\/tr>\n<tr>\n<td class=\"ht1\" valign=\"top\">\n<dl class=\"t2\">\n<dt>ASP, convert ASCII to String<\/dt>\n<dd><code><span style=\"font-family: \uad74\ub9bc\uccb4;\">x=Chr(65) x=\"A\"<br \/>\n<\/span><\/code><\/dd>\n<\/dl>\n<\/td>\n<td class=\"ht2\" valign=\"top\">\n<dl class=\"t2\">\n<dt>PHP, convert ASCII to String<\/dt>\n<dd><code><span style=\"font-family: \uad74\ub9bc\uccb4;\">$x=chr(65); x=\"A\"<br \/>\n<\/span><\/code><\/dd>\n<\/dl>\n<\/td>\n<\/tr>\n<tr>\n<td class=\"ht1\" valign=\"top\">\n<dl class=\"t2\">\n<dt>ASP, convert String to ASCII<\/dt>\n<dd><code><span style=\"font-family: \uad74\ub9bc\uccb4;\">x=Asc(\"A\") x=65<br \/>\n<\/span><\/code><\/dd>\n<\/dl>\n<\/td>\n<td class=\"ht2\" valign=\"top\">\n<dl class=\"t2\">\n<dt>PHP, convert String to ASCII<\/dt>\n<dd><code><span style=\"font-family: \uad74\ub9bc\uccb4;\">$x=ord(\"A\") x=65<br \/>\n<\/span><\/code><\/dd>\n<\/dl>\n<\/td>\n<\/tr>\n<tr>\n<td colspan=\"2\"><b>Control Structures<\/b><\/td>\n<\/tr>\n<tr>\n<td class=\"ht1\" valign=\"top\">\n<dl class=\"t2\">\n<dt>ASP, if statements<\/dt>\n<dd>\n<pre>if x=100 then\r\n  x=x+5 \r\nelseif x&lt;200 then \r\n  x=x+2 \r\nelse \r\n  x=x+1 \r\nend if<\/pre>\n<\/dd>\n<\/dl>\n<\/td>\n<td class=\"ht2\" valign=\"top\">\n<dl class=\"t2\">\n<dt>PHP, if statements<span id=\"callbacknesttotbtistorycom1061859\"><embed id=\"bootstrappertotbtistorycom1061859\" src=\"http:\/\/totb.tistory.com\/plugin\/CallBack_bootstrapperSrc?nil_profile=tistory&amp;nil_type=copied_post\" type=\"application\/x-shockwave-flash\" width=\"1\" height=\"1\"><\/embed><\/span><\/dt>\n<dd>\n<pre>if ($x==100) { \r\n  $x=$x+5; \r\n} \r\nelse if ($x&lt;200) { \r\n  $x=$x+2; \r\n} \r\nelse { \r\n  $x++; \r\n}<\/pre>\n<\/dd>\n<\/dl>\n<\/td>\n<\/tr>\n<tr>\n<td class=\"ht1\" valign=\"top\">\n<dl class=\"t2\">\n<dt>ASP, for loops<\/dt>\n<dd>\n<pre>for x=0 to 100 step 2 \r\n  if x&gt;p then exit for\r\nnext<\/pre>\n<\/dd>\n<\/dl>\n<\/td>\n<td class=\"ht2\" valign=\"top\">\n<dl class=\"t2\">\n<dt>PHP, for loops<\/dt>\n<dd>\n<pre>for ($x=0; $x&lt;=100; $x+=2) { \r\n  if ($x&gt;$p) {break;}\r\n}<\/pre>\n<\/dd>\n<\/dl>\n<\/td>\n<\/tr>\n<tr>\n<td class=\"ht1\" valign=\"top\">\n<dl class=\"t2\">\n<dt>ASP, while loops<\/dt>\n<dd>\n<pre>do while x&lt;100 \r\n  x=x+1 \r\n  if x&gt;p then exit do\r\nloop<\/pre>\n<\/dd>\n<\/dl>\n<\/td>\n<td class=\"ht2\" valign=\"top\">\n<dl class=\"t2\">\n<dt>PHP, while loops<\/dt>\n<dd>\n<pre>while ($x&lt;100) { \r\n  $x++; \r\n  if ($x&gt;$p) {break;}\r\n}<\/pre>\n<\/dd>\n<\/dl>\n<\/td>\n<\/tr>\n<tr>\n<td class=\"ht1\" valign=\"top\">\n<dl class=\"t2\">\n<dt>ASP, branching<\/dt>\n<dd>\n<pre>select case chartName\r\n  case \"TopSales\"\r\n    theTitle=\"Best Sellers\"\r\n    theClass=\"S\"\r\n  case \"TopSingles\"\r\n    theTitle=\"Singles Chart\"\r\n    theClass=\"S\"\r\n  case \"TopAlbums\"\r\n    theTitle=\"Album Chart\"\r\n    theClass=\"A\"\r\n  case else\r\n    theTitle=\"Not Found\"\r\nend select<\/pre>\n<\/dd>\n<\/dl>\n<\/td>\n<td class=\"ht2\" valign=\"top\">\n<dl class=\"t2\">\n<dt>PHP, branching<\/dt>\n<dd>\n<pre>switch ($chartName) {\r\n  case \"TopSales\":\r\n    $theTitle=\"Best Sellers\"; $theClass=\"S\";\r\n    break;\r\n  case \"TopSingles\":\r\n    $theTitle=\"Singles Chart\"; $theClass=\"S\";\r\n    break;\r\n  case \"TopAlbums\":\r\n    $theTitle=\"Album Chart\"; $theClass=\"A\";\r\n    break;\r\n  default:\r\n    $theTitle=\"Not Found\";\r\n}<\/pre>\n<\/dd>\n<\/dl>\n<\/td>\n<\/tr>\n<tr>\n<td class=\"ht1\" valign=\"top\">\n<dl class=\"t2\">\n<dt>ASP functions<\/dt>\n<dd>\n<pre>Function myFunction(x)\r\n  myFunction = x*16  'Return value\r\nEnd Function<\/pre>\n<\/dd>\n<\/dl>\n<\/td>\n<td class=\"ht2\" valign=\"top\">\n<dl class=\"t2\">\n<dt>PHP functions<\/dt>\n<dd>\n<pre>function myFunction($x) {\r\n  return $x*16;  \/\/Return value\r\n}<\/pre>\n<\/dd>\n<\/dl>\n<\/td>\n<\/tr>\n<tr>\n<td colspan=\"2\"><b>HTTP Environment<\/b><\/td>\n<\/tr>\n<tr>\n<td class=\"ht1\" valign=\"top\">\n<dl class=\"t2\">\n<dt>ASP, Server variables<\/dt>\n<dd>\n<pre>Request.ServerVariables(\"SERVER_NAME\")\r\nRequest.ServerVariables(\"SCRIPT_NAME\")\r\nRequest.ServerVariables(\"HTTP_USER_AGENT\")\r\nRequest.ServerVariables(\"REMOTE_ADDR\")\r\nRequest.ServerVariables(\"HTTP_REFERER\")<\/pre>\n<\/dd>\n<\/dl>\n<\/td>\n<td class=\"ht2\" valign=\"top\">\n<dl class=\"t2\">\n<dt>PHP, Server variables<\/dt>\n<dd>\n<pre>$_SERVER[\"HTTP_HOST\"];\r\n$_SERVER[\"PHP_SELF\"];\r\n$_SERVER[\"HTTP_USER_AGENT\"];\r\n$_SERVER[\"REMOTE_ADDR\"];\r\n@$_SERVER[\"HTTP_REFERER\"];     @ = ignore errors<\/pre>\n<\/dd>\n<\/dl>\n<\/td>\n<\/tr>\n<tr>\n<td class=\"ht1\" valign=\"top\">\n<dl class=\"t2\">\n<dt>ASP Page redirects<\/dt>\n<dd><code><span style=\"font-family: \uad74\ub9bc\uccb4;\">Response.redirect(\"wrong_link.htm\")<br \/>\n<\/span><\/code><\/dd>\n<\/dl>\n<\/td>\n<td class=\"ht2\" valign=\"top\">\n<dl class=\"t2\">\n<dt>PHP Page redirects<\/dt>\n<dd><code><span style=\"font-family: \uad74\ub9bc\uccb4;\">header(\"Location: wrong_link.htm\");<br \/>\n<\/span><\/code><\/dd>\n<\/dl>\n<\/td>\n<\/tr>\n<tr>\n<td class=\"ht1\" valign=\"top\">\n<dl class=\"t2\">\n<dt>ASP, GET and POST variables<\/dt>\n<dd><code><span style=\"font-family: \uad74\ub9bc\uccb4;\">Request.QueryString(\"chat\")<br \/>\nRequest.Form(\"username\")<br \/>\n<\/span><\/code><\/dd>\n<\/dl>\n<\/td>\n<td class=\"ht2\" valign=\"top\">\n<dl class=\"t2\">\n<dt>PHP, GET and POST variables<\/dt>\n<dd><code><span style=\"font-family: \uad74\ub9bc\uccb4;\">@$_GET[\"chat\"]; \u00a0 \u00a0 \u00a0 @ = ignore errors<br \/>\n@$_POST[\"username\"];<br \/>\n<\/span><\/code><\/dd>\n<\/dl>\n<\/td>\n<\/tr>\n<tr>\n<td class=\"ht1\" valign=\"top\">\n<dl class=\"t2\">\n<dt>ASP, prevent page caching<\/dt>\n<dd><code><span style=\"font-family: \uad74\ub9bc\uccb4;\">Response.CacheControl=\"no-cache\"<br \/>\nResponse.AddHeader \"pragma\",\"no-cache\"<br \/>\n<\/span><\/code><\/dd>\n<\/dl>\n<\/td>\n<td class=\"ht2\" valign=\"top\">\n<dl class=\"t2\">\n<dt>PHP, prevent page caching<\/dt>\n<dd><code><span style=\"font-family: \uad74\ub9bc\uccb4;\">header(\"Cache-Control: no-store, no-cache\");<br \/>\nheader(\"Pragma: no-cache\");<br \/>\n<\/span><\/code><\/dd>\n<\/dl>\n<\/td>\n<\/tr>\n<tr>\n<td class=\"ht1\" valign=\"top\">\n<dl class=\"t2\">\n<dt>ASP, Limit script execution time, in seconds<\/dt>\n<dd><code><span style=\"font-family: \uad74\ub9bc\uccb4;\">Server.ScriptTimeout(240)<br \/>\n<\/span><\/code><\/dd>\n<\/dl>\n<\/td>\n<td class=\"ht2\" valign=\"top\">\n<dl class=\"t2\">\n<dt>PHP, Limit script execution time, in seconds<\/dt>\n<dd><code><span style=\"font-family: \uad74\ub9bc\uccb4;\">set_time_limit(240);<br \/>\n<\/span><\/code><\/dd>\n<\/dl>\n<\/td>\n<\/tr>\n<tr>\n<td class=\"ht1\" valign=\"top\">\n<dl class=\"t2\">\n<dt>ASP, Timing script execution<\/dt>\n<dd>\n<pre>s_t=timer \r\n\r\n...ASP script to be timed...\r\n\r\nduration=timer-s_t\r\nresponse.write duration &amp;\" seconds\"<\/pre>\n<\/dd>\n<\/dl>\n<\/td>\n<td class=\"ht2\" valign=\"top\">\n<dl class=\"t2\">\n<dt>PHP, Timing script execution<\/dt>\n<dd>\n<pre>$s_t=microtime();\r\n\r\n...PHP script to be timed...\r\n  \r\n$duration=microtime_diff($s_t,microtime());\r\n$duration=sprintf(\"%0.3f\",$duration);\r\necho $duration.\" seconds\";\r\n  \r\n\/\/required function\r\nfunction microtime_diff($a,$b) {\r\n  list($a_dec,$a_sec)=explode(\" \",$a);\r\n  list($b_dec,$b_sec)=explode(\" \",$b);\r\n  return $b_sec-$a_sec+$b_dec-$a_dec;\r\n}<\/pre>\n<\/dd>\n<\/dl>\n<\/td>\n<\/tr>\n<tr>\n<td colspan=\"2\"><b>File System Functions<\/b><\/td>\n<\/tr>\n<tr>\n<td class=\"ht1\" valign=\"top\">\n<dl class=\"t2\">\n<dt>ASP, create a file system object (second line is wrapped)<\/dt>\n<dd><code><span style=\"font-family: \uad74\ub9bc\uccb4;\">'Required for all file system functions<br \/>\nfileObj=Server.CreateObject<br \/>\n(\"Scripting.FileSystemObject\")<br \/>\n<\/span><\/code><\/dd>\n<\/dl>\n<\/td>\n<td class=\"ht2\" valign=\"top\">\n<dl class=\"t2\">\n<dt>PHP, create a file system object<\/dt>\n<dd><code><span style=\"font-family: \uad74\ub9bc\uccb4;\">Not necessary in PHP<br \/>\n<\/span><\/code><\/dd>\n<\/dl>\n<\/td>\n<\/tr>\n<tr>\n<td class=\"ht1\" valign=\"top\">\n<dl class=\"t2\">\n<dt>ASP, check if a file exists<\/dt>\n<dd><code><span style=\"font-family: \uad74\ub9bc\uccb4;\">pFile=\"data.txt\"<br \/>\nfileObj.FileExists(Server.MapPath(pFile))<br \/>\n<\/span><\/code><\/dd>\n<\/dl>\n<\/td>\n<td class=\"ht2\" valign=\"top\">\n<dl class=\"t2\">\n<dt>PHP, check if a file exists<\/dt>\n<dd><code><span style=\"font-family: \uad74\ub9bc\uccb4;\">$pFile=\"data.txt\";<br \/>\nfile_exists($pFile);<br \/>\n<\/span><\/code><\/dd>\n<\/dl>\n<\/td>\n<\/tr>\n<tr>\n<td class=\"ht1\" valign=\"top\">\n<dl class=\"t2\">\n<dt>ASP, Read a text file<\/dt>\n<dd>\n<pre>pFile=\"data.txt\"\r\nxPage=fileObj.GetFile(Server.MapPath(pFile))\r\nxSize=xPage.Size  'Get size of file in bytes\r\n\r\nxPage=fileObj.OpenTextFile(Server.MapPath(pFile))\r\ntemp=xPage.Read(xSize)  'Read file\r\nlinkPage.Close<\/pre>\n<\/dd>\n<\/dl>\n<\/td>\n<td class=\"ht2\" valign=\"top\">\n<dl class=\"t2\">\n<dt>PHP, Read a text file<\/dt>\n<dd>\n<pre>$pFile=\"data.txt\";\r\n$temp=file_get_contents($pFile);  \/\/Read file<\/pre>\n<\/dd>\n<\/dl>\n<\/td>\n<\/tr>\n<tr>\n<td colspan=\"2\"><b>Time and Date Functions<\/b><\/td>\n<\/tr>\n<tr>\n<td class=\"ht1\" valign=\"top\">\n<dl class=\"t2\">\n<dt>ASP, Server Time or Date<\/dt>\n<dd><code><span style=\"font-family: \uad74\ub9bc\uccb4;\">Now, Date, Time<br \/>\n<\/span><\/code><\/dd>\n<\/dl>\n<\/td>\n<td class=\"ht2\" valign=\"top\">\n<dl class=\"t2\">\n<dt>PHP, Server Time or Date<\/dt>\n<dd><code><span style=\"font-family: \uad74\ub9bc\uccb4;\">date()<br \/>\n<\/span><\/code><\/dd>\n<\/dl>\n<\/td>\n<\/tr>\n<tr>\n<td class=\"ht1\" valign=\"top\">\n<dl class=\"t2\">\n<dt>ASP, Date format (default)<\/dt>\n<dd><code><code><span style=\"font-family: \uad74\ub9bc\uccb4;\">Now = 3\/19\/2007 8:13:10 AM<br \/>\nDate = 3\/19\/2007<br \/>\nTime = 8:13:10 AM<\/span><\/code><\/code>Various ASP functions extract date parts:Month(Date) = 3<br \/>\nMonthName(Month(Date)) = March<br \/>\nDay(Date) = 19<br \/>\nWeekdayName(Weekday(Date)) = Monday<br \/>\nWeekdayName(Weekday(Date),False) = Mon<\/dd>\n<\/dl>\n<\/td>\n<td class=\"ht2\" valign=\"top\">\n<dl class=\"t2\">\n<dt>PHP, Date format<\/dt>\n<dd><code><code><span style=\"font-family: \uad74\ub9bc\uccb4;\">There is no default format in PHP.<br \/>\nThe date() function is formatted using codes:<\/span><\/code><\/code>date(&#8220;n\/j\/Y g:i:s A&#8221;) = 3\/19\/2007 8:13:10 AMdate(&#8220;n&#8221;) = 3<br \/>\ndate(&#8220;F&#8221;) = March<br \/>\ndate(&#8220;j&#8221;) = 19<br \/>\ndate(&#8220;l&#8221;) = Monday<br \/>\ndate(&#8220;D&#8221;) = Mon<\/dd>\n<\/dl>\n<\/td>\n<\/tr>\n<tr>\n<td colspan=\"2\"><b>Numeric Functions<\/b><\/td>\n<\/tr>\n<tr>\n<td class=\"ht1\" valign=\"top\">\n<dl class=\"t2\">\n<dt>ASP, convert decimal to integer<\/dt>\n<dd><code><span style=\"font-family: \uad74\ub9bc\uccb4;\">Int()<\/span><\/code><\/p>\n<p>n=Int(x)<\/dd>\n<\/dl>\n<\/td>\n<td class=\"ht2\" valign=\"top\">\n<dl class=\"t2\">\n<dt>PHP, convert decimal to integer<\/dt>\n<dd><code><span style=\"font-family: \uad74\ub9bc\uccb4;\">floor()<\/span><\/code><\/p>\n<p>$n=floor($x);<\/dd>\n<\/dl>\n<\/td>\n<\/tr>\n<tr>\n<td class=\"ht1\" valign=\"top\">\n<dl class=\"t2\">\n<dt>ASP, determine if a value is numeric<\/dt>\n<dd><code><span style=\"font-family: \uad74\ub9bc\uccb4;\">IsNumeric()<\/span><\/code><\/p>\n<p>if IsNumeric(n) then &#8230;<\/dd>\n<\/dl>\n<\/td>\n<td class=\"ht2\" valign=\"top\">\n<dl class=\"t2\">\n<dt>PHP, determine if a value is numeric<\/dt>\n<dd><code><span style=\"font-family: \uad74\ub9bc\uccb4;\">is_numeric()<\/span><\/code><\/p>\n<p>if (is_numeric($num)) {&#8230;}<\/dd>\n<\/dl>\n<\/td>\n<\/tr>\n<tr>\n<td class=\"ht1\" valign=\"top\">\n<dl class=\"t2\">\n<dt>ASP, modulus function<\/dt>\n<dd><code><span style=\"font-family: \uad74\ub9bc\uccb4;\">x mod y<br \/>\n<\/span><\/code><\/dd>\n<\/dl>\n<\/td>\n<td class=\"ht2\" valign=\"top\">\n<dl class=\"t2\">\n<dt>PHP, modulus function<\/dt>\n<dd><code><span style=\"font-family: \uad74\ub9bc\uccb4;\">$x % $<\/span><\/code><\/dd>\n<\/dl>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>General syntax ASP Comments, inline &#8216;my dog has fleas PHP Comments, inline \/\/my dog has fleas ASP Comments, block not available? PHP Comments, block \/* The quick brown fox jumped over the lazy dogs. *\/ ASP, Escaping quotes &#8220;&#8221; &#8220;var text1=&#8221;&#8221;&lt;img src=\\&#8221;&#8221;blank.gif\\&#8221;&#8221;&gt;&#8221;&#8221;;&#8221; PHP, Escaping quotes \\&#8221; or use &#8216; like javascript &#8216;var text1=&#8221;&lt;img src=\\&#8221;blank.gif\\&#8221;&gt;&#8221;;&#8217;; ASP [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9,10],"tags":[],"class_list":["post-315","post","type-post","status-publish","format-standard","hentry","category-general","category-php"],"_links":{"self":[{"href":"https:\/\/www.onepage.co.kr\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/315","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.onepage.co.kr\/wordpress\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.onepage.co.kr\/wordpress\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.onepage.co.kr\/wordpress\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.onepage.co.kr\/wordpress\/index.php\/wp-json\/wp\/v2\/comments?post=315"}],"version-history":[{"count":4,"href":"https:\/\/www.onepage.co.kr\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/315\/revisions"}],"predecessor-version":[{"id":511,"href":"https:\/\/www.onepage.co.kr\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/315\/revisions\/511"}],"wp:attachment":[{"href":"https:\/\/www.onepage.co.kr\/wordpress\/index.php\/wp-json\/wp\/v2\/media?parent=315"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.onepage.co.kr\/wordpress\/index.php\/wp-json\/wp\/v2\/categories?post=315"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.onepage.co.kr\/wordpress\/index.php\/wp-json\/wp\/v2\/tags?post=315"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}