ASP.Net C# – PHP Equivalents
No Comments
by Byron Bennett / September 17th, 2008
![]()

On this post, I will be collecting ASP.NET C# commands that I use frequently in PHP but I have to continually look up in the little bit of ASP.NET that I do. PHP can be frustrating for its inconsistencies in syntax, but what is even more frustrating is when you’re trying to do something in C# and you’re trying to remember whether the common sense syntax is in PHP or C#…This tries to be a cheat sheet for those for me:
| PHP | ASP.net |
| echo ‘string’; | Response.Write(“the_text_goes_here”); |
| $_REQUEST['parameter_name']; | Request.QueryString["parameter_name"]; |
| urlencode( string ); | Server.UrlEncode( string ); |
| Convert unix timestamp:date(“m.d.y”, $timestamp); | public static System.DateTime UnixToDotNet(int unixTimestamp) { System.DateTime date = System.DateTime.Parse(“1/1/1970″); return date.AddSeconds(unixTimestamp); } |
| Connection string: mysql_connect([string $server [,string $username [, string $password [,bool $new_link [, int $client_flags ]]]]] ) |
Code for using conn string in Web.config:
string dbConn = System.Configuration.ConfigurationManager.ConnectionStrings["QueryStringName"].ToString(); |
Popularity: 8%
Filed under: ASP.NET/C#
