Multilined String in PHP

Multilined string in PHP can be written in many different ways to have your codes look clean and neat. Method 1: You can break the lines into multiple strings on multiple lines using a period in front of the assignment sign in order to concatenate them. Usage: $st  = “This is the book”; $st .= ” that I really like to read in my spare time.”; $st .= ” I bring it with me while I’m traveling this summer.”; Method 2: Use excerpt sign and…

Continue reading »

Using backslash when echo quotation marks

Sometimes you’ll see quotation marks in a string that represent exact language that has come from somebody else. The quotation mark is also used to designate speech acts in fiction and poetry. For example: Mr. Douglas, who was working in his field that morning, said, “The alien spaceship appeared right before my own eyes.” In this case, if you want to echo this string out on a php page, you will have to add a backslash in front of each quotation mark to ensure that…

Continue reading »

Comparison of PHP json libraries

Today I start a project of building an Android Application that allows lenders to search for a certified and trained appraisers within their preferred area. To build a simple app, you can use REST to return data. You will need Json extension on the PHP server to have the task done. If you would like to know how to install JSON on your PHP server (only PHP version below 5.2), go to http://www.php.net/manual/en/json.installation.php. Most of the hosting servers nowadays have PHP version 5.2 that comes…

Continue reading »

How to get an IP address of a visitor to your website using PHP?

Sometimes you will want to know the IP address of any visitor to your website for marketing analysis, or for sales chart purposes, or for geo location analysis of your website visitors.  By using PHP, finding an IP address nowadays is much easier. It is very important requirement for many scripts where we store the members or visitors details. For security reason we can store IP address of our visitors who are doing any purchases or recording the geographical location of the visitor can be…

Continue reading »