<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0"><channel><atom:link rel="hub" href="http://tumblr.superfeedr.com/" xmlns:atom="http://www.w3.org/2005/Atom"/><description>I will attempt to make this my new blog. My new home. This seems to be a really cool tool for blogging. Much needed at this point.</description><title>The Blog of Ravi Gehlot</title><generator>Tumblr (3.0; @ravigehlot)</generator><link>http://ravigehlot.net/</link><item><title>What Entrepreneurs Can Learn from McDonalds Founder, Ray </title><description>&lt;iframe width="400" height="300" src="http://www.youtube.com/embed/MdKUxYDZeTQ?wmode=transparent&amp;autohide=1&amp;egm=0&amp;hd=1&amp;iv_load_policy=3&amp;modestbranding=1&amp;rel=0&amp;showinfo=0&amp;showsearch=0" frameborder="0" allowfullscreen&gt;&lt;/iframe&gt;&lt;br/&gt;&lt;br/&gt;&lt;p&gt;&lt;h1 id="watch-headline-title"&gt;&lt;span id="eow-title" class="long-title" dir="ltr" title="What Entrepreneurs Can Learn from McDonalds Founder, Ray"&gt;What Entrepreneurs Can Learn from McDonalds Founder, Ray &lt;/span&gt;&lt;/h1&gt;&lt;/p&gt;</description><link>http://ravigehlot.net/post/6889439046</link><guid>http://ravigehlot.net/post/6889439046</guid><pubDate>Fri, 24 Jun 2011 23:06:55 -0400</pubDate></item><item><title>How to Create a Relevant Small Business </title><description>&lt;iframe width="400" height="300" src="http://www.youtube.com/embed/IEMQxBYEGRM?wmode=transparent&amp;autohide=1&amp;egm=0&amp;hd=1&amp;iv_load_policy=3&amp;modestbranding=1&amp;rel=0&amp;showinfo=0&amp;showsearch=0" frameborder="0" allowfullscreen&gt;&lt;/iframe&gt;&lt;br/&gt;&lt;br/&gt;&lt;p&gt;&lt;h1 id="watch-headline-title"&gt;&lt;span id="eow-title" dir="ltr" title="How to Create a Relevant Small Business"&gt;How to Create a Relevant Small Business &lt;/span&gt;&lt;/h1&gt;&lt;/p&gt;</description><link>http://ravigehlot.net/post/6889384793</link><guid>http://ravigehlot.net/post/6889384793</guid><pubDate>Fri, 24 Jun 2011 23:05:23 -0400</pubDate></item><item><title>Another PHP assessment test sent by another recruiter</title><description>&lt;p&gt;I was given another ONLINE assessment test from a site called &lt;a href="http://select2perform.com/." target="_blank"&gt;http://select2perform.com/.&lt;/a&gt; The assessment is from a company called PreVisor ONLINE(Pre Employment Screening, Assessment Testing, Online Personality Test) from &lt;a href="http://www.previsor.com/." target="_blank"&gt;http://www.previsor.com/.&lt;/a&gt; I will try to go over what I remember. This assessment was way harder than &lt;span class="l noline"&gt;the other one I had taken from Proveit2&lt;/span&gt;&lt;span class="l noline"&gt;.com.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;HTML_quickform&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;The PEAR::&lt;em&gt;HTML_QuickForm&lt;/em&gt; package provides methods for creating, validating, processing HTML forms.&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;&lt;strong&gt;([0123][0-9])-([01][0-9])-([0-9]{4})&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;This regex will validate a date.&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;&lt;strong&gt;ReflectionClass&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;PHP 5 comes with a complete reflection API that adds the ability to    &lt;em&gt;reverse-engineer&lt;/em&gt; classes, interfaces, functions,    methods and extensions. Additionally, the reflection API offers ways to    retrieve doc comments for functions, classes and methods. The &lt;strong class="classname"&gt;ReflectionClass&lt;/strong&gt; class reports     information about a class.&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;&lt;strong&gt;odbc_execute&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;span class="dc-title"&gt;Execute a prepared statement. &lt;/span&gt;Executes a SQL statement based on the result identifier           passed from odbc_prepare(). Used for MSSQL.&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;&lt;strong&gt;Which function do you use to determine what happens when XML&lt;/strong&gt;&lt;br/&gt;&lt;strong&gt;nodes are parsed by an XML parser?&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;Sets the element handler functions for the XML &lt;em&gt;parser&lt;/em&gt;.    &lt;em&gt;start_element_handler&lt;/em&gt; and    &lt;em&gt;end_element_handler&lt;/em&gt; are strings containing    the names of functions that must exist when &lt;span class="function"&gt;&lt;span class="function"&gt;xml_parse()&lt;/span&gt;&lt;/span&gt; is called for &lt;em&gt;parser&lt;/em&gt;.&lt;/li&gt;
&lt;/ul&gt;</description><link>http://ravigehlot.net/post/6474360622</link><guid>http://ravigehlot.net/post/6474360622</guid><pubDate>Sun, 12 Jun 2011 22:00:00 -0400</pubDate></item><item><title>More PHP quizzes (Part 1)</title><description>&lt;p&gt;I am at the Orange County Public Library in Orlando, FL reading &amp;#8220;SAMS Teach Yourself PHP in 24 Hours&amp;#8221; by Matt Zandstra. A PHP book&lt;br/&gt;copyrighted in 2004. In this book there are many PHP exercises that are useful for those willing to take the ZEND Certification test.&lt;/p&gt;
&lt;p&gt;Remember, it is in the easy questions that most of us tend to get wrong.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;****************&lt;/strong&gt;&lt;/em&gt;&lt;strong&gt; The Building Blocks &lt;/strong&gt;&lt;em&gt;&lt;strong&gt;****************&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;br/&gt;1) Which of the following variables names is not valid?&lt;br/&gt;&lt;br/&gt;a) $a_value_submitted_by_a_user&lt;br/&gt;b) $6666666xyz&lt;br/&gt;c) $xvz6666666&lt;br/&gt;d) $____counter_____&lt;br/&gt;e) the first&lt;br/&gt;f) file-name&lt;br/&gt;&lt;br/&gt;&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;em&gt;&lt;strong&gt;Answer:&lt;/strong&gt;&lt;/em&gt; The answer is a, e and f. A PHP variable many only begin with a letter or underscore and it may only have alphanumeric after that.&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;&lt;br/&gt;2) What will the following code fragment output?&lt;br/&gt;&lt;br/&gt;$num = 33;&lt;br/&gt;(boolean) $num;&lt;br/&gt;print $num;&lt;br/&gt;&lt;br/&gt;&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;em&gt;&lt;strong&gt;Answer&lt;/strong&gt;&lt;/em&gt;: The answer is 33 even though the value was converted.&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;&lt;br/&gt;3) What will the following statement output?&lt;br/&gt;&lt;br/&gt;print gettype(&amp;#8220;4&amp;#8221;);&lt;br/&gt;&lt;br/&gt;&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;em&gt;&lt;strong&gt;Answer&lt;/strong&gt;&lt;/em&gt;: string&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;&lt;br/&gt;4) What will be the output from the following code fragment?&lt;br/&gt;&lt;br/&gt;$test_val = 5.4566;&lt;br/&gt;settype($test_val, &amp;#8220;integer&amp;#8221;);&lt;br/&gt;print $test_val;&lt;br/&gt;&lt;br/&gt;&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;em&gt;&lt;strong&gt;Answer&lt;/strong&gt;&lt;/em&gt;: It will print the number 5. Any information beyong the decimal point is lost.&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;&lt;br/&gt;5) Which of the following statements does not contain an expression?&lt;br/&gt;&lt;br/&gt;4;&lt;br/&gt;gettype(44);&lt;br/&gt;5/12;&lt;br/&gt;&lt;br/&gt;&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;em&gt;&lt;strong&gt;Answer&lt;/strong&gt;&lt;/em&gt;: They are all expressions because they all resolve to values.&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;&lt;br/&gt;6) Which of the statements in question 5 contains an operator?&lt;br/&gt;&lt;br/&gt;&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;em&gt;&lt;strong&gt;Answer&lt;/strong&gt;&lt;/em&gt;: The 3rd one has a division operator.&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;&lt;br/&gt;7) What value will the following expression return, and what data type will the returned value be?&lt;/p&gt;
&lt;p&gt;5 &amp;lt; 2&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;em&gt;&lt;strong&gt;Answer&lt;/strong&gt;&lt;/em&gt;: The expression will resolve to false, which is a boolean value.&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;&lt;em&gt;&lt;strong&gt;**************** Control Structures &lt;/strong&gt;&lt;/em&gt;&lt;em&gt;&lt;strong&gt;****************&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;br/&gt;1) Must a control structure&amp;#8217;s test expression result in a Boolean value?&lt;br/&gt;&lt;br/&gt;&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;em&gt;&lt;strong&gt;Answer&lt;/strong&gt;&lt;/em&gt;: Yes. However, in the context of a test expression 0(zero), NULL(undefined variable), &amp;#8220;&amp;#8221;(empty string) will all result in false for the purpose of the test. All other values evaluate to true.&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;&lt;br/&gt;2) Must I always surround a code block in a control statement with brackets?&lt;br/&gt;&lt;br/&gt;&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;em&gt;&lt;strong&gt;Answer&lt;/strong&gt;&lt;/em&gt;: If it only consists of 1 line, you can omit the brackets. But it is good practice for readability to have brackets. &lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;****************&lt;/strong&gt;&lt;/em&gt;&lt;strong&gt; Functions &lt;/strong&gt;&lt;em&gt;&lt;strong&gt;****************&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;br/&gt;1) Apart from the global keyword, is there any way that a function can access and change global variables?&lt;br/&gt;&lt;br/&gt;&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;em&gt;&lt;strong&gt;Answer&lt;/strong&gt;&lt;/em&gt;: You can also access global variables anywhere in your scripts with a built-in associative array called $GLOBALS. To access a global variable called $test within a function, you could reference it as $GLOBALS[&amp;#8216;test&amp;#8217;]. &lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;&lt;br/&gt;2) Can you include a function call within a string, as you can with a variable?&lt;br/&gt;&lt;br/&gt;&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;em&gt;&lt;strong&gt;Answer&lt;/strong&gt;&lt;/em&gt;: No. You must call funtions outside quotation marks.&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;&lt;br/&gt;3) True or false: If a function doesn&amp;#8217;t require an argument, you can omit the parentheses in the function call.&lt;br/&gt;&lt;br/&gt;&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;em&gt;&lt;strong&gt;Answer&lt;/strong&gt;&lt;/em&gt;: false. You must always include the parentheses in your function calls, whether or not you are passing arguments to the function.&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;****************&lt;/strong&gt;&lt;/em&gt;&lt;strong&gt; Arrays &lt;/strong&gt;&lt;em&gt;&lt;strong&gt;****************&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;br/&gt;1) I can discover the number of elements in an array, so should I use a for statement loop through an array?&lt;br/&gt;&lt;br/&gt;&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;em&gt;&lt;strong&gt;Answer&lt;/strong&gt;&lt;/em&gt;: You should be cautious of this technique. If you are not absolutely sure that the array you are reading is indexed by consecutively numbered keys, you might get unexpected results.&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;&lt;br/&gt;2) Which construct can you use to define an array?&lt;br/&gt;&lt;br/&gt;&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;em&gt;&lt;strong&gt;Answer&lt;/strong&gt;&lt;/em&gt;: array()&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;&lt;br/&gt;3) Without using a function, what would be the easiest way of adding the element &amp;#8220;Susan&amp;#8221; to the $users array ($users = array(&amp;#8220;Harry&amp;#8221;, &amp;#8220;Bob&amp;#8221;, &amp;#8220;Sandy&amp;#8221;);)?&lt;br/&gt;&lt;br/&gt;&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;em&gt;&lt;strong&gt;Answer&lt;/strong&gt;&lt;/em&gt;: $users[] = &amp;#8220;Susan&amp;#8221;;&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;&lt;br/&gt;4) Which function could you use to add the string &amp;#8220;Susan&amp;#8221; to the $users array?&lt;br/&gt;&lt;br/&gt;&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;em&gt;&lt;strong&gt;Answer&lt;/strong&gt;&lt;/em&gt;: array_push($users, &amp;#8216;Susan&amp;#8217;);&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;&lt;br/&gt;5) Which function would you use to merge two array?&lt;br/&gt;&lt;br/&gt;&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;em&gt;&lt;strong&gt;Answer&lt;/strong&gt;&lt;/em&gt;: array_merge();&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;&lt;br/&gt;6) How would you sort an associate array by its key?&lt;br/&gt;&lt;br/&gt;&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;em&gt;&lt;strong&gt;Answer&lt;/strong&gt;&lt;/em&gt;: ksort();&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;****************&lt;/strong&gt;&lt;/em&gt;&lt;strong&gt; Working with strings &lt;/strong&gt;&lt;em&gt;&lt;strong&gt;****************&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;1) Is &amp;lt;pre&amp;gt; tags the best way for formatting plain text on the browser?&lt;br/&gt;&lt;br/&gt;&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;em&gt;&lt;strong&gt;Answer&lt;/strong&gt;&lt;/em&gt;: &amp;lt;pre&amp;gt; tags can be useful if you want to preserve plain-text formatting in an HTML context. If you want to output an entire text document to the browser, however, it is neater to tell the browser to format the entire output as plain text. You can do this with the header() function: Header(&amp;#8220;Content-Type: Text/Plain&amp;#8221;);&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;&lt;br/&gt;2) Which conversion specifier would you use with printf() to format an integer as a double? Write down the full syntax required&lt;br/&gt;to convert the integer 33.&lt;br/&gt;&lt;br/&gt;&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;em&gt;&lt;strong&gt;Answer&lt;/strong&gt;&lt;/em&gt;: The conversion specifier f is used to format an integer as a double: printf(&amp;#8220;%f&amp;#8221;, 33);&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;&lt;br/&gt;3) How would you pad the conversion you effected in question 2 with zeroes so that the part before the decimal point is four&lt;br/&gt;characters long?&lt;br/&gt;&lt;br/&gt;&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;em&gt;&lt;strong&gt;Answer&lt;/strong&gt;&lt;/em&gt;: You can pad the output from printf() with the padding specifier &amp;#8212; that is, a space or a zero followed by a number representing the number of characters by which you want to pad: printf(&amp;#8220;%04f&amp;#8221;, 33);&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;&lt;br/&gt;4) How would you specify a precision of two decimal places for the floating-point number you have been formatting in the previous&lt;br/&gt;question? &lt;br/&gt;&lt;br/&gt;&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;em&gt;&lt;strong&gt;Answer&lt;/strong&gt;&lt;/em&gt;: The precision specifier consists of a dot(.) followed by a number representing the precision you want to apply. It should be placed before the conversion specifier: printf(&amp;#8220;%04.2f&amp;#8221;, 33);&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;&lt;br/&gt;5) Which function would you use to determine the length of a string?&lt;br/&gt;&lt;br/&gt;&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;em&gt;&lt;strong&gt;Answer&lt;/strong&gt;&lt;/em&gt;: The strlen() funciton returns the length of a string.&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;&lt;br/&gt;6) Which function would you use to acquire the starting index of a substring within a string?&lt;br/&gt;&lt;br/&gt;&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;em&gt;&lt;strong&gt;Answer&lt;/strong&gt;&lt;/em&gt;: The substr() function returns the starting index of a substring.&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;&lt;br/&gt;7) Which function would you use to extract a substring from a string?&lt;br/&gt;&lt;br/&gt;&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;em&gt;&lt;strong&gt;Answer&lt;/strong&gt;&lt;/em&gt;: The substr() function extracts and returns a substring.&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;&lt;br/&gt;8) How might you remove white space from the beginning of a string?&lt;br/&gt;&lt;br/&gt;&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;em&gt;&lt;strong&gt;Answer&lt;/strong&gt;&lt;/em&gt;: The ltrim() function removes white space from the start of a string.&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;&lt;br/&gt;9) How would you convert a string to uppercase characters?&lt;br/&gt;&lt;br/&gt;&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;em&gt;&lt;strong&gt;Answer&lt;/strong&gt;&lt;/em&gt;: The strtoupper() function convert a string to uppercase characters.&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;&lt;br/&gt;10) How would you break up a delimited string into an array of substrings?&lt;br/&gt;&lt;br/&gt;&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;em&gt;&lt;strong&gt;Answer&lt;/strong&gt;&lt;/em&gt;: The explode() function splits up a string into an array.&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;****************&lt;/strong&gt;&lt;/em&gt;&lt;strong&gt; Objects &lt;/strong&gt;&lt;em&gt;&lt;strong&gt;****************&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;br/&gt;1) What is the $this special variable?&lt;br/&gt;&lt;br/&gt;&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;em&gt;&lt;strong&gt;Answer&lt;/strong&gt;&lt;/em&gt;: Within a class, you sometimes need to call the class&amp;#8217;s methods or access its properties. By combining the $this variable and the -&amp;gt; operator, you can do both. The $this variable is the handle a class is automatically given to refer to itself and to its components.&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;&lt;br/&gt;2) How would you choose a name for a constructor method?&lt;br/&gt;&lt;br/&gt;&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;em&gt;&lt;strong&gt;Answer&lt;/strong&gt;&lt;/em&gt;: A constructor must either take the name of the class that contains it or it should be named __construct().&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;&lt;br/&gt;3) How would you prevent a method from being accessed except from within the current class and child classes?&lt;br/&gt;&lt;br/&gt;&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;em&gt;&lt;strong&gt;Answer&lt;/strong&gt;&lt;/em&gt;: You can limit availability of a method to the current class and child classes by using the protected keyword.&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;&lt;br/&gt;protected function dontTouchMe() {&lt;br/&gt;    // no access outside current class and children&lt;br/&gt;}&lt;br/&gt;&lt;br/&gt;4) What should you add to a class definition if you want to make it inherit functionality from another class?&lt;br/&gt;&lt;br/&gt;&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;em&gt;&lt;strong&gt;Answer&lt;/strong&gt;&lt;/em&gt;: For a class to inherit from another, it must be declared with the extends keyword and the name of the class from which you want to inherit.&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;****************&lt;/strong&gt;&lt;/em&gt;&lt;strong&gt; Forms &lt;/strong&gt;&lt;em&gt;&lt;strong&gt;****************&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;br/&gt;1) Which $_SERVER array element could you use to determinee the IP address of a user?&lt;br/&gt;&lt;br/&gt;&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;em&gt;&lt;strong&gt;Answer&lt;/strong&gt;&lt;/em&gt;: The $_SERVER[&amp;#8216;REMOTE_ADDR&amp;#8217;] element should store the user&amp;#8217;s IP address;&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;&lt;br/&gt;2) Which predefined variable could you use to find out about the browser that called your script?&lt;br/&gt;&lt;br/&gt;&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;em&gt;&lt;strong&gt;Answer&lt;/strong&gt;&lt;/em&gt;: Browser type and version, as well as the user&amp;#8217;s operating ysstem, are usually stored in an element called &amp;#8216;HTTP_USER_AGENT&amp;#8217; in the $_SERVER array.&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;&lt;br/&gt;3) What should you name your form fields if you want to find an array in the element $_REQUEST[&amp;#8216;form_array&amp;#8217;]?&lt;br/&gt;&lt;br/&gt;&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;em&gt;&lt;strong&gt;Answer&lt;/strong&gt;&lt;/em&gt;: Creating multiple fields with the name form_array[] creates a populated array in $_REQUEST[&amp;#8216;form_array&amp;#8217;] when the form is submitted.&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;&lt;br/&gt;4) Which superglobal associative array contains all values submitted as part of a GET request and which superglobal array $_POST&lt;br/&gt;contains all values submitted as part of a POST request?&lt;br/&gt;&lt;br/&gt;&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;em&gt;&lt;strong&gt;Answer&lt;/strong&gt;&lt;/em&gt;: The superglobal array $_GET  contains all values submitted as part of a GET request. The superglobal array $_POST contains all values submitted as part of a POST request.&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;&lt;br/&gt;5) What function would you use to redirect the browser to a new page? What string would you pass it?&lt;br/&gt;&lt;br/&gt;&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;em&gt;&lt;strong&gt;Answer&lt;/strong&gt;&lt;/em&gt;: header(&amp;#8220;Location: anotherPage.html&amp;#8221;);&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;&lt;br/&gt;6) How can you limit the size of a file that a user can submit via a particular upload form?&lt;br/&gt;&lt;br/&gt;&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;em&gt;&lt;strong&gt;Answer&lt;/strong&gt;&lt;/em&gt;: When creating upload forms in PHP, you can include a hidden field called MAX_FILE_SIZE: &amp;lt;input type=&amp;#8221;hidden&amp;#8221; name=&amp;#8221;MAX_FILE_SIZE&amp;#8221; value=&amp;#8221;51200&amp;#8221; /&amp;gt;&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;&lt;br/&gt;7) How can you set a limit on the size of upload files for all forms and scripts?&lt;br/&gt;&lt;br/&gt;&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;em&gt;&lt;strong&gt;Answer&lt;/strong&gt;&lt;/em&gt;: The php.ini option upload_max_filesize determines the maximum size of an upload that any script will accept.&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;****************&lt;/strong&gt;&lt;/em&gt;&lt;strong&gt; Working with files &lt;/strong&gt;&lt;em&gt;&lt;strong&gt;****************&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;br/&gt;&lt;br/&gt;1) Will the include() statement slow down my scripts?&lt;br/&gt;&lt;br/&gt;&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;em&gt;&lt;strong&gt;Answer&lt;/strong&gt;&lt;/em&gt;: Because an include file must be opened and parsed by the engine, it will add some overhead. The benefits of reusable code libraries often outweigh the relatively low performance overhead, however.&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;&lt;br/&gt;2) Should I always end script execution if a file cannot be opened for writing or reading?&lt;br/&gt;&lt;br/&gt;&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;em&gt;&lt;strong&gt;Answer&lt;/strong&gt;&lt;/em&gt;: You should always allow for this possibility. If your script absolutely depends on the file with which you want to work, you might want to use the die() function, writing an informative error message to the browser. In less critical situations, you still need to allow for the failure, perhaps adding it to a log file.&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;&lt;br/&gt;3) Which function would you use to find out whether a file is present on your file system?&lt;br/&gt;&lt;br/&gt;&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;em&gt;&lt;strong&gt;Answer&lt;/strong&gt;&lt;/em&gt;: You can test for the existence of a file with the file_exists() function.&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;&lt;br/&gt;4) How would you determine the size of a file?&lt;br/&gt;&lt;br/&gt;&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;em&gt;&lt;strong&gt;Answer&lt;/strong&gt;&lt;/em&gt;: The filesize() function returns a file&amp;#8217;s size in bytes.&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;&lt;br/&gt;5) Which function would you use to open a file for reading and writing?&lt;br/&gt;&lt;br/&gt;&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;em&gt;&lt;strong&gt;Answer&lt;/strong&gt;&lt;/em&gt;: The fopen() function opens a file. It accepts the path to a file and a character representing the mode. It returns a resource.&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;&lt;br/&gt;6) Which function would you use to read a line of data from a file?&lt;br/&gt;&lt;br/&gt;&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;em&gt;&lt;strong&gt;Answer&lt;/strong&gt;&lt;/em&gt;: The fgets() function reads data up to the buffer size you pass it, the end off linee, or the end of the document, whichever comes first.&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;&lt;br/&gt;7) How can you tell when you have reached the end of file?&lt;br/&gt;&lt;br/&gt;&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;em&gt;&lt;strong&gt;Answer&lt;/strong&gt;&lt;/em&gt;: The feof() function returns true when the file resource it is passed has reached the end of the file.&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;&lt;br/&gt;8) Which function you use to write a line of data to a file?&lt;br/&gt;&lt;br/&gt;&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;em&gt;&lt;strong&gt;Answer&lt;/strong&gt;&lt;/em&gt;: You can write data to a file with fputs() function.&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;&lt;br/&gt;9) How would you open a directory for reading?&lt;br/&gt;&lt;br/&gt;&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;em&gt;&lt;strong&gt;Answer&lt;/strong&gt;&lt;/em&gt;: The opendir() function enables you to open a directory for reading.&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;&lt;br/&gt;10) Which function would you use to read the name of a directory item after you have opened a directory for reading?&lt;br/&gt;&lt;br/&gt;&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;em&gt;&lt;strong&gt;Answer&lt;/strong&gt;&lt;/em&gt;: The readdir() function returns the name of a directory item from an opened directory.&lt;/li&gt;
&lt;/ul&gt;</description><link>http://ravigehlot.net/post/6368753095</link><guid>http://ravigehlot.net/post/6368753095</guid><pubDate>Thu, 09 Jun 2011 20:37:00 -0400</pubDate></item><item><title>Gisela De la Torre sent me an amazing video with a great...</title><description>&lt;iframe width="400" height="299" src="http://www.youtube.com/embed/YDRId6QmNTA?wmode=transparent&amp;autohide=1&amp;egm=0&amp;hd=1&amp;iv_load_policy=3&amp;modestbranding=1&amp;rel=0&amp;showinfo=0&amp;showsearch=0" frameborder="0" allowfullscreen&gt;&lt;/iframe&gt;&lt;br/&gt;&lt;br/&gt;&lt;p&gt;Gisela De la Torre sent me an amazing video with a great message. I  thought that it would be a great idea to share it on here. I heard the  video and typed it. If you find inconsistencies, just let me know and I  will fix it. I  may have missed one or two words that I didn’t understand.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;English version:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Ladies and gentleman of the class of 99. Wear sunscreen. If I could  offer you only one tip for the future. Sunscreen would be it. As long  term benefits of sunscreen have been proved by scientists. Where the  rest of my advice has no bases more reliable than my own unique  experience. I will dispense this advice.&lt;/p&gt;
&lt;p&gt;Enjoy the power and beauty of your youth or never mind.&lt;/p&gt;
&lt;p&gt;You will not understand the power and beauty of your youth until they fade it.&lt;/p&gt;
&lt;p&gt;But trust me, in 20 years you will look back at photos of yourself in  a calling away you can grasp now, how much possibility lay before you,  and how fabulous you really looked.&lt;/p&gt;
&lt;p&gt;You are not as fat as you imagined.&lt;/p&gt;
&lt;p&gt;Don’t worry about the future, or worry but know that worrying is  effective as trying to solve an algebra equation by chewing bubble gum.&lt;/p&gt;
&lt;p&gt;The real troubles in your life are things that never crossed your  worried mind, the kind that blindside you at 4:00 PM at an idle  Saturday. Do one thing everyday, that scares you.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;SING&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Don’t be reckless with other people hearts and don’t put up with people that are reckless with yours.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;FLOSS&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Don’t waste your time in jealousy, some times you are ahead, some times you are behind.&lt;/p&gt;
&lt;p&gt;The race is long and at the end, it is only with yourself.&lt;/p&gt;
&lt;p&gt;Remember compliments that you received. Forget the insults. If you succeeded in doing this. Tell me how.&lt;/p&gt;
&lt;p&gt;keep your old love letters, throw away your old bank statements.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;STRETCH&lt;/strong&gt;…&lt;/p&gt;
&lt;p&gt;Don’t feel guilty if you don’t know what you wanna do with your life.  The most interesting people I know didn’t know at 22 what they wanted  to do with their lives. Some of the most interesting 40 years old I know  still don’t.&lt;/p&gt;
&lt;p&gt;Get plenty of calcium….be kind to your needs…you will miss them where they aren’t.&lt;/p&gt;
&lt;p&gt;Maybe you will marry, maybe you won’t, maybe you will have children,  maybe you won’t, maybe you will divorce at 40, maybe you will dance the  funky chicken in your 75th wedding anniversary.&lt;/p&gt;
&lt;p&gt;Whatever you do don’t congratulate yourself too much or berate your self too either.&lt;/p&gt;
&lt;p&gt;Your choices are HALF CHANCE…so are EVERYBODY ELSE.&lt;/p&gt;
&lt;p&gt;Enjoy your body, use it every way you can, don’t be afraid of it or  other people think of it. it’s the greatest instrument that you will  ever own.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;DANCE&lt;/strong&gt;…&lt;/p&gt;
&lt;p&gt;even if you don’t have nowhere to do it but in your own living room…&lt;/p&gt;
&lt;p&gt;read the directions, even if you don’t follow them&lt;/p&gt;
&lt;p&gt;don’t read beauty magazine, they will only make you feel ugly.&lt;/p&gt;
&lt;p&gt;(music playing)&lt;/p&gt;
&lt;p&gt;Get to know your parents, you don’t know when they will be gone for good.&lt;/p&gt;
&lt;p&gt;Be nice to your siblings, they are the best link to your past. They are most likely to stick with you in the future.&lt;/p&gt;
&lt;p&gt;Understand that friends come and go with a precious few that you should hold on.&lt;/p&gt;
&lt;p&gt;Work hard to reach the gaps in geography and lifestyle. Because the  older you get, the more you need the people you knew when you were  young.&lt;/p&gt;
&lt;p&gt;Live in New York city once but leave before it makes you hard, Live  in Northern California once but leave before it makes you soft.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;TRAVEL&lt;/strong&gt;…&lt;/p&gt;
&lt;p&gt;Accept certain and liable truths, prices will raise, politicians will  filtrated. You too will get old, and when you do, you will fantasy that  when you were young, prices were reasonable, politicians were noble and  children respected their elders. Respect your elders. Don’t expect  anyone else to support you. Maybe you have a trust fund, maybe you have a  wealth spouse but you never know when either might run out. Don’t mess  too much with your hair or by the time you are 40, you will look like  85.&lt;/p&gt;
&lt;p&gt;Be careful whose advice you buy, but be patient with those who supply  it. Advice, the form of nostalgia. Dispensing it is a way of dishing  the past from the disposal, wiping it off, painting over the ugly parts  and recycling it for more than it is worth.&lt;/p&gt;
&lt;p&gt;But trust me on the sunscreen.&lt;/p&gt;</description><link>http://ravigehlot.net/post/6213017549</link><guid>http://ravigehlot.net/post/6213017549</guid><pubDate>Sun, 05 Jun 2011 10:54:00 -0400</pubDate></item><item><title>PHP Arrays Ex. #2: Simple Array Loop</title><description>&lt;p&gt;In this post, I will go over question number #2 from &lt;a href="http://phpexercises.com/php-simple-array-loop-exercise.html" target="_blank"&gt;http://phpexercises.com/php-simple-array-loop-exercise.html&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Please look at my code (what I came up with):&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&amp;lt;?php&lt;br/&gt;/*&lt;br/&gt;PHP Arrays Ex. #2: Simple Array Loop&lt;br/&gt;&lt;br/&gt;For this exercise, you will use a list of ten of the largest cities in the world. &lt;br/&gt;(Please note, these are not the ten largest, just a selection of ten from the largest cities.) &lt;br/&gt;Create an array with the following values: Tokyo, Mexico City, New York City, Mumbai, Seoul, &lt;br/&gt;Shanghai, Lagos, Buenos Aires, Cairo, London.&lt;br/&gt;&lt;br/&gt;Print these values to the browser separated by commas, using a loop to iterate over the array. &lt;br/&gt;Sort the array, then print the values to the browser in an unordered list, again using a loop.&lt;br/&gt;&lt;br/&gt;Add the following cities to the array: Los Angeles, Calcutta, Osaka, Beijing. Sort the array &lt;br/&gt;again, and print it once more to the browser in an unordered list.&lt;br/&gt;*/&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;$list = array(&amp;#8216;Tokyo&amp;#8217; , &amp;#8216;Mexico City&amp;#8217;, &amp;#8216;New York City&amp;#8217;, &amp;#8216;Mumbai&amp;#8217;, &amp;#8216;Seoul&amp;#8217;, &amp;#8216;Shanghai&amp;#8217;, &amp;#8216;Lagos&amp;#8217;, &amp;#8216;Buenos Aires&amp;#8217;, &amp;#8216;Cairo&amp;#8217;, &amp;#8216;London&amp;#8217;);&lt;br/&gt;&lt;br/&gt;asort($list);&lt;br/&gt;foreach($list as $key =&amp;gt; $value) {&lt;br/&gt;    echo $value;&lt;br/&gt;    echo &amp;#8216;, &amp;#8216;;&lt;br/&gt;}&lt;br/&gt;&lt;br/&gt;array_push($list, &amp;#8216;Los Angeles&amp;#8217;, &amp;#8216;Calcutta&amp;#8217;, &amp;#8216;Osaka&amp;#8217;, &amp;#8216;Beijing&amp;#8217;);&lt;br/&gt;&lt;br/&gt;echo &amp;#8216;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;#8217;;&lt;br/&gt;&lt;br/&gt;asort($list);&lt;br/&gt;foreach($list as $key =&amp;gt; $value) {&lt;br/&gt;    echo $value;&lt;br/&gt;    echo &amp;#8216;, &amp;#8216;;&lt;br/&gt;}&lt;br/&gt;?&amp;gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Now look at their code answer (click on view script):&lt;/p&gt;
&lt;p&gt;&lt;a href="http://phpexercises.com/php-simple-array-loop-exercise.html" target="_blank"&gt;http://phpexercises.com/php-simple-array-loop-exercise.html&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The difference between our codes lies in the function to sort the array. I used &lt;em&gt;asort &lt;/em&gt;while they used &lt;em&gt;sort&lt;/em&gt;. We both got the same results using different functions. What is the difference though? Let&amp;#8217;s check it out. When using sort, new keys are assigned for the elements in the array. For example, if you have ([a] =&amp;gt; &amp;#8216;me&amp;#8217;, [b] =&amp;gt; &amp;#8216;you&amp;#8217;) it sorts to ([0] =&amp;gt; &amp;#8216;me&amp;#8217;, [1] =&amp;gt; &amp;#8216;you&amp;#8217;). With asort, the function sorts an array by values. The values keep their original key(index).&lt;/p&gt;</description><link>http://ravigehlot.net/post/6175250604</link><guid>http://ravigehlot.net/post/6175250604</guid><pubDate>Sat, 04 Jun 2011 10:01:00 -0400</pubDate></item><item><title>Job Interview Tips</title><description>&lt;p&gt;This month of June has been a blessing. Not only did I get an interview for a web development career position in Orlando, FL but I also made it through the first round of interviews. I was invited back for a 2nd interview. This is all good news. In this post, I am going to talk about my experience with my latest job interview. Let me start by saying that, in the past, I had been through a few other recruiting companies. So I was well prepared for this interview. So lets go over some points.&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;strong&gt;knowing your worth: annual salary&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;            Do you know what you are worth? maybe? maybe not? Well,  you should known your numbers. My advice to you is not to go looking for  work when you don&amp;#8217;t know your worth. Do you have a Bachelors Degree but  no experience? Well, that is what you are worth. At least for now. With  a Bachelors Degree and no experience at hands, ask for no less than 45k after taxes. If you have a  Bachelors Degree and years of experience then do NOT settle for less  than 75k. If you only have experience but your experience is extensive  then settle for no less than 60k. If you are an intermediate like me  with just an Associates Degree then settle for no less than 50k. That is your worth. Don&amp;#8217;t go asking for 80k or 90k when you are not worth that much. Remember, if you claim to be a senior upfront, that&amp;#8217;s how you will be seen in the company. Be prepared for some fire when you bottleneck. People who possess important certifications like the: Zend PHP, MySQL and PayPal certifications can ask for close to 70k. The more education you have, the more credentials you get to prove your worth.&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;strong&gt;having a good &amp;amp; reliable recruiter is key&lt;br/&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;            Your recruiter is your first contact. That&amp;#8217;s the person who will represent you in your job endeavor. So do your research and make sure that you hire a recruiter that you know is professional, respectful and has work ethics. Think of it as if you were hiring a lawyer for a civil/criminal case. Would hire a bad lawyer? Only if you didn&amp;#8217;t know better. The same line of thought applies for recruiters. You, the programmer, must do your research and make sure to hire the right person to represent you. Indeed, a professional recruiter will have time to call you often to discuss the position while being courteous. A good recruiter won&amp;#8217;t give you excuses like &amp;#8220;I am not at my desk, I don&amp;#8217;t have your information&amp;#8221; or &amp;#8220;Call me tomorrow and we will talk&amp;#8221;. Those are red flags. That is not professional. A good recruiter will go straight to the point. Do not settle for just any recruiter. Remember, you wouldn&amp;#8217;t settle for just about any lawyer. A good recruiter e-mails you back and forth to make sure that you have all the information you need way before the 1st interview. Now, get this, the BEST recruiter will actually tell you the company name. There is no reason to withhold that information because sooner or later you will have to know the company name anyways. Some recruiters choose not to reveal that info until you sign paperwork. Oh well, what is the problem with doing that? How do you know that the company in which you are about to be interviewed is not a scam? How do you know that it is legit? How do you know if that company is what you are looking for? The only way is to Google it and find out everything that you can about the company. Your time is valuable and you need to make sure that a recruiter values it. You are not begging for a job, you are looking for the ideal fit. Also, make sure to be comfortable with your recruiter. That&amp;#8217;s the person who will assist you for the next 6-months probation period in which you are hired through the recruiting company not the actual company that you work for. If anything happens, you have to be comfortable to talk to your recruiter.&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;strong&gt;your resume&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;           Your resume MUST NOT contain any lies or exaggerations. You don&amp;#8217;t have to list all the companies that you worked for in the past. You can not make up information. Your resume is sort of like a Diploma. You can not fake it. If you do, a simple &amp;#8220;background check&amp;#8221; will catch any inconsistencies. If you have done side work then make sure to be clear. Your resume is you. Be real! Be original! Be yourself! If you have any questions, ask your recruiter. They are equipped to help you came up with the best looking resume possible. I went a step further and built my own personal website. On my website(&lt;a href="http://www.ravigehlot.com/" target="_blank"&gt;http://www.ravigehlot.com/&lt;/a&gt;), recruiters can even log in and see an interactive resume with links. From that member section, they can download my most up-to-date resume. I built that site to e-mail me whenever a recruiter signs in. That way I keep track of whom is downloading my resume. I also have this blog(&lt;a href="http://www.ravigehlot.net/" target="_blank"&gt;http://www.ravigehlot.net/&lt;/a&gt;).&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;strong&gt;do your homework&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;           Got company-name? Google it. Your job is to find out everything and anything that you can about the company in question. You plan to spend your next couple of years working for that company; so make sure that it is what you want. Google is your best friend. If the company has any negative reviews, you will come across it ONLINE. Watch out for companies that are scam. They do exist. A good honest recruiter knows the company they work with. This is where choosing a good recruiter can benefit you on the long run. Do your job, avoid being part of a disaster. Once you know that the company is legit, find out if what they do interests you. Remember, you will spend 40 to 50 week hours working for that company. Do not set yourself up for failure. Make sure that you like what they do.&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;strong&gt;be prepared: 1st interview&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;           Your recruiter found you a good paying job. You have already agreed on the annual salary rate and you know that the company is legit. Now you are up against your first interview. My advice to you is BE PREPARED. If you know that your job interview is in 2 days then make sure to follow up with your recruiter immediately. If your recruiter has not sent you detailed instructions then ask for it as soon as possible. You should have a full job description along with other important information like the interviewer&amp;#8217;s location and name. Make sure to be at the location 1 hour prior to your interview. I mean, you should always have 1 hour to work any unanticipated events like heavy traffic, blown tire and etc. You must look and feel your best. So make sure that you dress professionally and that you feel comfortable. Be confident. You are trying to score a job but you aren&amp;#8217;t meeting the President. You are meeting an ordinary person like you. There is absolutely no reason to be nervous. Make eye contact.&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;strong&gt;thank you letter&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;          If you made it through the first round of interviews then make sure to take time to thank your interviewer. They will appreciate your acknowledgment. Ask your recruiter to send a thank you letter.&lt;/p&gt;
&lt;p&gt;Ravi.&lt;/p&gt;</description><link>http://ravigehlot.net/post/6165880089</link><guid>http://ravigehlot.net/post/6165880089</guid><pubDate>Sat, 04 Jun 2011 00:25:00 -0400</pubDate></item><item><title>'string' == true, 0 == false, 'string' == 0</title><description>&lt;p&gt;&lt;strong&gt;What happens in the follow piece of code?&lt;/strong&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;$a = &amp;#8216;string&amp;#8217;;&lt;/p&gt;
&lt;p&gt;$b = 0;&lt;/p&gt;
&lt;p&gt;if($a == true &amp;amp;&amp;amp; $b == false &amp;amp;&amp;amp; $a == $b) {&lt;/p&gt;
&lt;p&gt;echo &amp;#8216;hum rum&amp;#8217;;&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;

&lt;/blockquote&gt;
&lt;ul&gt;&lt;li&gt;In &lt;strong&gt;&amp;#8216;string&amp;#8217; == true&lt;/strong&gt;, any non-null string evaluates to true when compared with a Boolean.&lt;/li&gt;
&lt;li&gt;In &lt;strong&gt;0 == false&lt;/strong&gt;, the integer 0 undergoes implicit conversation to Boolean and evaluates to false. &lt;/li&gt;
&lt;li&gt;In &lt;strong&gt;&amp;#8216;string&amp;#8217; == 0&lt;/strong&gt;, a string is silently promoted to integer when compared to an integer. &lt;/li&gt;
&lt;/ul&gt;</description><link>http://ravigehlot.net/post/6162362683</link><guid>http://ravigehlot.net/post/6162362683</guid><pubDate>Fri, 03 Jun 2011 22:29:53 -0400</pubDate></item><item><title>Interesting thread with Melih Birim on OO Inheritance</title><description>&lt;p&gt;&lt;ul class="commentList"&gt;&lt;li class="uiUfiComment comment_18800452 ufiItem ufiItem"&gt;&lt;a href="https://www.facebook.com/ravi.gehlot" target="_blank"&gt;&lt;img class="uiProfilePhoto uiProfilePhotoMedium img" src="https://fbcdn-profile-a.akamaihd.net/hprofile-ak-snc4/186116_1054155424_7524919_q.jpg"/&gt;&lt;/a&gt;&lt;a href="https://www.facebook.com/ravi.gehlot" target="_blank"&gt;Ravi Gehlot&lt;/a&gt; &lt;span data-jsid="text"&gt;I  like PHP way more than ColdFusion. If you know how to program in PHP,  you can gain speed(performance) that you would only get it with  ColdFusion if you were to get down to JAVA. Also, PHP is more OO.&lt;/span&gt;Il y a environ une heure · &lt;span class="comment_like_18800452 fsm fwn fcg"&gt;&lt;span class="default_message"&gt;J’aime&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li class="uiUfiComment comment_18800455 ufiItem ufiItem"&gt;&lt;a href="https://www.facebook.com/ravi.gehlot" target="_blank"&gt;&lt;img class="uiProfilePhoto uiProfilePhotoMedium img" src="https://fbcdn-profile-a.akamaihd.net/hprofile-ak-snc4/186116_1054155424_7524919_q.jpg"/&gt;&lt;/a&gt;&lt;a href="https://www.facebook.com/ravi.gehlot" target="_blank"&gt;Ravi Gehlot&lt;/a&gt; &lt;span data-jsid="text"&gt;‎:))&lt;/span&gt;Il y a environ une heure · &lt;span class="comment_like_18800455 fsm fwn fcg"&gt;&lt;span class="default_message"&gt;J’aime&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li class="uiUfiComment comment_18800540 ufiItem ufiItem"&gt;&lt;a href="https://www.facebook.com/melih.birim" target="_blank"&gt;&lt;img class="uiProfilePhoto uiProfilePhotoMedium img" src="https://fbcdn-profile-a.akamaihd.net/hprofile-ak-snc4/211642_669242845_1203672_q.jpg"/&gt;&lt;/a&gt;&lt;a href="https://www.facebook.com/melih.birim" target="_blank"&gt;Melih Birim&lt;/a&gt; &lt;span data-jsid="text"&gt;I realized that I hate OOP(it is complex, it is not scalable, it is not organizable, it is bull shit when not maintained well).&lt;/span&gt;Il y a 58 minutes · &lt;span class="comment_like_18800540 fsm fwn fcg"&gt;&lt;span class="default_message"&gt;J’aime&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li class="uiUfiComment comment_18800566 ufiItem ufiItem"&gt;&lt;a href="https://www.facebook.com/ravi.gehlot" target="_blank"&gt;&lt;img class="uiProfilePhoto uiProfilePhotoMedium img" src="https://fbcdn-profile-a.akamaihd.net/hprofile-ak-snc4/186116_1054155424_7524919_q.jpg"/&gt;&lt;/a&gt;&lt;a href="https://www.facebook.com/ravi.gehlot" target="_blank"&gt;Ravi Gehlot&lt;/a&gt; &lt;span data-jsid="text"&gt;true.  OOP is not for everyone. It&amp;#8217;s like school. School isn&amp;#8217;t for everybody.  It takes years of experience to master it. You have to have knowledge of  framework to kind of program OOP in an &amp;#8220;organized&amp;#8221; way. But I do like  it though. I am getting used to it. I will have you look at some of my  OO code later.&lt;/span&gt;Il y a 57 minutes · &lt;span class="comment_like_18800566 fsm fwn fcg"&gt;&lt;span class="default_message"&gt;J’aime&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li class="uiUfiComment comment_18800586 ufiItem ufiItem"&gt;&lt;a href="https://www.facebook.com/ravi.gehlot" target="_blank"&gt;&lt;img class="uiProfilePhoto uiProfilePhotoMedium img" src="https://fbcdn-profile-a.akamaihd.net/hprofile-ak-snc4/186116_1054155424_7524919_q.jpg"/&gt;&lt;/a&gt;&lt;a href="https://www.facebook.com/ravi.gehlot" target="_blank"&gt;Ravi Gehlot&lt;/a&gt; &lt;span data-jsid="text"&gt;But  you can get work done in Procedural programming as well. Nothing wrong  with that. they are 2 different styles of programming. But with  languages like JAVA, I can&amp;#8217;t see anybody trying procedural. JAVA is OO  to the guts man.&lt;/span&gt;Il y a 56 minutes · &lt;span class="comment_like_18800586 fsm fwn fcg"&gt;&lt;span class="default_message"&gt;J’aime&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li class="uiUfiComment comment_18800704 ufiItem ufiItem"&gt;&lt;a href="https://www.facebook.com/melih.birim" target="_blank"&gt;&lt;img class="uiProfilePhoto uiProfilePhotoMedium img" src="https://fbcdn-profile-a.akamaihd.net/hprofile-ak-snc4/211642_669242845_1203672_q.jpg"/&gt;&lt;/a&gt;&lt;a href="https://www.facebook.com/melih.birim" target="_blank"&gt;Melih Birim&lt;/a&gt; &lt;span data-jsid="text"&gt;I  still don&amp;#8217;t understand real usage of &amp;#8220;Inheritance&amp;#8221;.  Lets think  scripting languages, fe Python, it is both OO and Proce. but you can  write your modules and can use it later. Why I need another object has  same attributes but different beha&lt;span class="text_exposed_show"&gt;viours  like the inherited one. If I need an object, with different behaviours I  prefer Compositon DP over inheritance. Since in Java you allowed only  one inherited class but you can set different behaviours&amp;#8230;&lt;/span&gt;&lt;/span&gt;Il y a 50 minutes · &lt;span class="comment_like_18800704 fsm fwn fcg"&gt;&lt;span class="default_message"&gt;J’aime&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li class="uiUfiComment comment_18800804 ufiItem ufiItem"&gt;&lt;a href="https://www.facebook.com/ravi.gehlot" target="_blank"&gt;&lt;img class="uiProfilePhoto uiProfilePhotoMedium img" src="https://fbcdn-profile-a.akamaihd.net/hprofile-ak-snc4/186116_1054155424_7524919_q.jpg"/&gt;&lt;/a&gt;&lt;a href="https://www.facebook.com/ravi.gehlot" target="_blank"&gt;Ravi Gehlot&lt;/a&gt; &lt;span data-jsid="text"&gt;In  OO you always think real world events. So lets take for instance that  your parents want you to inherit their possessions. Well, you can either  leave everything that you worked for your entire life for what your  parents want to give you o&lt;span class="text_exposed_show"&gt;r you can just  take what your parents gave you and adapt(add) to what you already  have. You would inherited their possessions and still kept yours. They  are just one inseparable unit after that. You could try to buy a new  house of your own and then not accept your parent&amp;#8217;s house or you can buy  your house and keep theirs. But their house has its own characteristics  while yours has its own. The whole purpose of OO is to separate logic.&lt;/span&gt;&lt;/span&gt;Il y a 45 minutes · &lt;span class="comment_like_18800804 fsm fwn fcg"&gt;&lt;span class="default_message"&gt;J’aime&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li class="uiUfiComment comment_18800934 ufiItem ufiItem"&gt;&lt;a href="https://www.facebook.com/melih.birim" target="_blank"&gt;&lt;img class="uiProfilePhoto uiProfilePhotoMedium img" src="https://fbcdn-profile-a.akamaihd.net/hprofile-ak-snc4/211642_669242845_1203672_q.jpg"/&gt;&lt;/a&gt;&lt;a href="https://www.facebook.com/melih.birim" target="_blank"&gt;Melih Birim&lt;/a&gt; &lt;span data-jsid="text"&gt;well  thats my point, I know how to use OO and how to delegate login behind  it but why I need to separate the behaviours.  Probably it is not the  best thing to write everything in an object but as I said, this does not  mean the software can &lt;span class="text_exposed_show"&gt;not be modular.  Moduler systems also means separation of concerns, but not every moduler  system is OO, and not every OO project is moduler. My concern&amp;#160;: Is  project scalable? And is it modular?&lt;/span&gt;&lt;/span&gt;Il y a 39 minutes · &lt;span class="comment_like_18800934 fsm fwn fcg"&gt;&lt;span class="default_message"&gt;J’aime&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li class="uiUfiComment comment_18800983 ufiItem ufiItem"&gt;&lt;a href="https://www.facebook.com/ravi.gehlot" target="_blank"&gt;&lt;img class="uiProfilePhoto uiProfilePhotoMedium img" src="https://fbcdn-profile-a.akamaihd.net/hprofile-ak-snc4/186116_1054155424_7524919_q.jpg"/&gt;&lt;/a&gt;&lt;a href="https://www.facebook.com/ravi.gehlot" target="_blank"&gt;Ravi Gehlot&lt;/a&gt; &lt;span data-jsid="text"&gt;think  of the object as the union of code and data. the object is the MODULAR  unit for application development and code reuse. Inheritance has to do  with code re-usability. You inherit because it&amp;#8217;s the same thing. You  just don&amp;#8217;t want to have&lt;span class="text_exposed_show"&gt; to re-write  code. Also, by doing that, all inherited code fetches from one main  root. That root(parent class) delegates the other classes. So all you  got to change is 1 class. Not all.&lt;/span&gt;&lt;/span&gt;Il y a 36 minutes · &lt;span class="comment_like_18800983 fsm fwn fcg"&gt;&lt;span class="default_message"&gt;J’aime&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li class="uiUfiComment comment_18801022 ufiItem ufiItem"&gt;&lt;a href="https://www.facebook.com/ravi.gehlot" target="_blank"&gt;&lt;img class="uiProfilePhoto uiProfilePhotoMedium img" src="https://fbcdn-profile-a.akamaihd.net/hprofile-ak-snc4/186116_1054155424_7524919_q.jpg"/&gt;&lt;/a&gt;&lt;a href="https://www.facebook.com/ravi.gehlot" target="_blank"&gt;Ravi Gehlot&lt;/a&gt; &lt;span data-jsid="text"&gt;It  is scalable if you are working on a big project. If you are working on a  small project, I would go procedural with functions. OO is good for  medium-large size projects.&lt;/span&gt;Il y a 34 minutes · &lt;span class="comment_like_18801022 fsm fwn fcg"&gt;&lt;span class="default_message"&gt;J’aime&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li class="uiUfiComment comment_18801147 ufiItem ufiItem"&gt;&lt;a href="https://www.facebook.com/melih.birim" target="_blank"&gt;&lt;img class="uiProfilePhoto uiProfilePhotoMedium img" src="https://fbcdn-profile-a.akamaihd.net/hprofile-ak-snc4/211642_669242845_1203672_q.jpg"/&gt;&lt;/a&gt;&lt;a href="https://www.facebook.com/melih.birim" target="_blank"&gt;Melih Birim&lt;/a&gt; &lt;span data-jsid="text"&gt;I  know it is scalable, but it is not easy to implement and construct a  scalable project. And if it is not constructed well, it means nothing,  and means that project  will demolish your life and your company, and  you will need another project which for the place of current one, and  than you start with high expectations another 4 year project&amp;#8230; :-)&lt;/span&gt;Il y a 29 minutes · &lt;span class="comment_like_18801147 fsm fwn fcg"&gt;&lt;span class="default_message"&gt;Je n’aime plus&lt;/span&gt; ·  &lt;a href="https://www.facebook.com/browse/?type=likes&amp;amp;id=10150313474177846" target="_blank"&gt;1 personne&lt;/a&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li class="uiUfiComment comment_18801169 ufiItem ufiItem"&gt;&lt;a href="https://www.facebook.com/ravi.gehlot" target="_blank"&gt;&lt;img class="uiProfilePhoto uiProfilePhotoMedium img" src="https://fbcdn-profile-a.akamaihd.net/hprofile-ak-snc4/186116_1054155424_7524919_q.jpg"/&gt;&lt;/a&gt;&lt;a href="https://www.facebook.com/ravi.gehlot" target="_blank"&gt;Ravi Gehlot&lt;/a&gt; &lt;span data-jsid="text"&gt;Scalability  means that a project is able to keep up with growth. It&amp;#8217;s somewhat easy  to write classes that inherit from other classes. You already have the  prototype in hands but now you just want to scale the application to  accommodate grow&lt;span class="text_exposed_show"&gt;th. Sometimes they even  have an interface that you have to use. So all you go to do is write  those same methods prefaced in the interface and then inherit the  methods/properties from the base class and go from that point on. That&amp;#8217;s  scalable because it makes it for quick code writing and enables you to  move on quick. The thing with OO is that you have got to have some  knowledge of frameworks or you will be all over the place with it.&lt;/span&gt;&lt;/span&gt;Il y a 28 minutes · &lt;span class="comment_like_18801169 fsm fwn fcg"&gt;&lt;span class="default_message"&gt;J’aime&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li class="uiUfiComment comment_18801206 ufiItem ufiItem"&gt;&lt;a href="https://www.facebook.com/melih.birim" target="_blank"&gt;&lt;img class="uiProfilePhoto uiProfilePhotoMedium img" src="https://fbcdn-profile-a.akamaihd.net/hprofile-ak-snc4/211642_669242845_1203672_q.jpg"/&gt;&lt;/a&gt;&lt;a href="https://www.facebook.com/melih.birim" target="_blank"&gt;Melih Birim&lt;/a&gt; &lt;span data-jsid="text"&gt;if, mechanical/civil engineers used OOD think about world how could it be? :P&lt;/span&gt;Il y a 27 minutes · &lt;span class="comment_like_18801206 fsm fwn fcg"&gt;&lt;span class="default_message"&gt;J’aime&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li class="uiUfiComment comment_18801238 ufiItem ufiItem"&gt;&lt;a href="https://www.facebook.com/ravi.gehlot" target="_blank"&gt;&lt;img class="uiProfilePhoto uiProfilePhotoMedium img" src="https://fbcdn-profile-a.akamaihd.net/hprofile-ak-snc4/186116_1054155424_7524919_q.jpg"/&gt;&lt;/a&gt;&lt;a href="https://www.facebook.com/ravi.gehlot" target="_blank"&gt;Ravi Gehlot&lt;/a&gt; &lt;span data-jsid="text"&gt;right.  I agree with you. That&amp;#8217;s why I told you that some framework knowledge  is necessary. OO gives you the power to come up with your own framework.  So with OO, you do not need a third party framework because you are the  framework builder.&lt;span class="text_exposed_show"&gt; That&amp;#8217;s why they say  that it takes a lot of planning to build a successful OO app. You also  gotta document your code. That&amp;#8217;s why most people choose to adopt an  existing framework and use what had been previously developed.&lt;/span&gt;&lt;/span&gt;Il y a 26 minutes · &lt;span class="comment_like_18801238 fsm fwn fcg"&gt;&lt;span class="default_message"&gt;J’aime&lt;/span&gt; ·  &lt;a href="https://www.facebook.com/browse/?type=likes&amp;amp;id=10150313477492846" target="_blank"&gt;1 personne&lt;/a&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li class="uiUfiComment comment_18801259 ufiItem ufiItem"&gt;&lt;a href="https://www.facebook.com/melih.birim" target="_blank"&gt;&lt;img class="uiProfilePhoto uiProfilePhotoMedium img" src="https://fbcdn-profile-a.akamaihd.net/hprofile-ak-snc4/211642_669242845_1203672_q.jpg"/&gt;&lt;/a&gt;&lt;a href="https://www.facebook.com/melih.birim" target="_blank"&gt;Melih Birim&lt;/a&gt; &lt;span data-jsid="text"&gt;seems  we are talking about different ways, I am talking about pm side of how  OO changes(ruins) your life, at the other side(developer) it is very  nice thing to know, your system is OO and it might(!) be scalable and  maintainable&amp;#8230; But not allow you to design again.&lt;/span&gt;Il y a 25 minutes · &lt;span class="comment_like_18801259 fsm fwn fcg"&gt;&lt;span class="default_message"&gt;J’aime&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li class="uiUfiComment comment_18801291 ufiItem ufiItem"&gt;&lt;a href="https://www.facebook.com/ravi.gehlot" target="_blank"&gt;&lt;img class="uiProfilePhoto uiProfilePhotoMedium img" src="https://fbcdn-profile-a.akamaihd.net/hprofile-ak-snc4/186116_1054155424_7524919_q.jpg"/&gt;&lt;/a&gt;&lt;a href="https://www.facebook.com/ravi.gehlot" target="_blank"&gt;Ravi Gehlot&lt;/a&gt; &lt;span data-jsid="text"&gt;oh I see. You mean, you would have to stick with the original idea. But wouldn&amp;#8217;t that apply to procedural programming as well?&lt;/span&gt;Il y a 23 minutes · &lt;span class="comment_like_18801291 fsm fwn fcg"&gt;&lt;span class="default_message"&gt;J’aime&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li class="uiUfiComment comment_18801313 ufiItem ufiItem"&gt;&lt;a href="https://www.facebook.com/ravi.gehlot" target="_blank"&gt;&lt;img class="uiProfilePhoto uiProfilePhotoMedium img" src="https://fbcdn-profile-a.akamaihd.net/hprofile-ak-snc4/186116_1054155424_7524919_q.jpg"/&gt;&lt;/a&gt;&lt;a href="https://www.facebook.com/ravi.gehlot" target="_blank"&gt;Ravi Gehlot&lt;/a&gt; &lt;span data-jsid="text"&gt;With  Procedural, after you wrote your hundreds of functions then it makes it  hard to change the idea of doing the project a different way. You can&amp;#8217;t  really change the design unless you were to change the entire project.&lt;/span&gt;Il y a 22 minutes · &lt;span class="comment_like_18801313 fsm fwn fcg"&gt;&lt;span class="default_message"&gt;J’aime&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li class="uiUfiComment comment_18801438 ufiItem ufiItem"&gt;&lt;a href="https://www.facebook.com/melih.birim" target="_blank"&gt;&lt;img class="uiProfilePhoto uiProfilePhotoMedium img" src="https://fbcdn-profile-a.akamaihd.net/hprofile-ak-snc4/211642_669242845_1203672_q.jpg"/&gt;&lt;/a&gt;&lt;a href="https://www.facebook.com/melih.birim" target="_blank"&gt;Melih Birim&lt;/a&gt; &lt;span data-jsid="text"&gt;think  about functional programming, fe, D  or Earlang, it is well used by  Facebook, Ericssonn and Nortel. You combine similar functions in a  module. And can use it later on. just like jars. But the things is java  is using functions(methods)&lt;span class="text_exposed_show"&gt; as well as  other programming languages. and also in functional programming design  is not something you want change everyday, the flow of the project might  change, so that you can easily write another flow that fits your need.  :)&lt;/span&gt;&lt;/span&gt;Il y a 16 minutes · &lt;span class="comment_like_18801438 fsm fwn fcg"&gt;&lt;span class="default_message"&gt;J’aime&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li class="uiUfiComment comment_18801516 ufiItem ufiItem"&gt;&lt;a href="https://www.facebook.com/ravi.gehlot" target="_blank"&gt;&lt;img class="uiProfilePhoto uiProfilePhotoMedium img" src="https://fbcdn-profile-a.akamaihd.net/hprofile-ak-snc4/186116_1054155424_7524919_q.jpg"/&gt;&lt;/a&gt;&lt;a href="https://www.facebook.com/ravi.gehlot" target="_blank"&gt;Ravi Gehlot&lt;/a&gt; &lt;span data-jsid="text"&gt;That&amp;#8217;s  the thing ;) You don&amp;#8217;t want to have to change things around too much.  Think about your car. Your car is a great example of it. Why you would  want to change the design of it when regardless of what you do, the car  will continue to run&lt;span class="text_exposed_show"&gt; the same methods.  It will accelerate and stop. That what cars do. I am not going to try to  get under the hood and put an airplane engine there. I could&amp;#8230;but I  wouldn&amp;#8217;t ;) If I were to install an airplane engine on it, it wouldn&amp;#8217;t  make sense.&lt;/span&gt;&lt;/span&gt;Il y a 12 minutes · &lt;span class="comment_like_18801516 fsm fwn fcg"&gt;&lt;span class="default_message"&gt;J’aime&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/p&gt;</description><link>http://ravigehlot.net/post/6110525821</link><guid>http://ravigehlot.net/post/6110525821</guid><pubDate>Thu, 02 Jun 2011 12:39:00 -0400</pubDate></item><item><title>A brief about WeLocateRentals.com</title><description>&lt;ul&gt;&lt;li&gt;&lt;strong&gt;A bit about history&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;&lt;a href="http://www.WeLocateRentals.com/" target="_blank"&gt;http://www.WeLocateRentals.com/&lt;/a&gt; was a project that I started working on in August of 2010. It all began in my apartment complex. I happened to be in the complex office using their computers. I noticed that the guy next to me was having some Internet connectivity issues. So I offered to help him. He asked me what I did for a living and I said web development. That guy, Tim Hyatt, had mentioned that his uncle needed to build a website. His uncle has properties and land over in New Jersey and Philadelphia so he wanted a website to help him rent his own properties and that of his friends. So I took his uncle&amp;#8217;s phone number and called it up. At that point, we did not have a clear and concise idea of how we would build the site or what features would be available. What we knew is that we wanted to post properties ONLINE and have people go there to see pictures.&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;strong&gt;More ideas&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;From that idea, we began to develop it into a much bigger idea. Remember, always THINK BIG. Initially, my boss had the vision to build &lt;a href="http://www.WeLocateRentals.com/" target="_blank"&gt;http://www.WeLocateRentals.com/&lt;/a&gt; for the New Jersey area. He wanted it to be localized. I had brought it up to him that if were going to do it for the New Jersey area then why not do it for the other 49 remaining states? We could target it nationwide. That&amp;#8217;s when the idea of &amp;#8220;Franchisers&amp;#8221; came up. We would still build the website to target local areas but we would set it up in a way that states could function as their own Franchisers. Basically, the idea was to build a search engine that would let people search properties nationwide as well as in specific areas of interest. Each state would work as it&amp;#8217;s own Franchiser and each Franchiser would have a designated Agent. Pretty cool. So we have Agents for the state of Florida, New Jersey and Philadelphia. When someone posts a property for any of the aforementioned states, the Agents phone number shows up in the property profile. When a renter finds that property and calls it up, he/she goes through an Agent. That Agent then closes the deal between the landlord and the renter. We get to keep the 1st month&amp;#8217;s rent for connecting the landlord with the renter.&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;strong&gt;More features: Landlords and Renters&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;We are working to offer more services for paid members. For example, landlords will able to &lt;em&gt;run background checks&lt;/em&gt; right from &lt;a href="http://www.WeLocateRentals.com/." target="_blank"&gt;http://www.WeLocateRentals.com/.&lt;/a&gt; Landlords will able to fill out &lt;em&gt;lease forms&lt;/em&gt;, &lt;em&gt;waivers&lt;/em&gt;, &lt;em&gt;renewals &lt;/em&gt;and &lt;em&gt;eviction forms&lt;/em&gt; right from their accounts. We plan to offer a way for renters to &lt;em&gt;pay their rent dues from our website&lt;/em&gt;. There will be &lt;em&gt;automatic e-mail reminders &lt;/em&gt;and &lt;em&gt;late fee notices&lt;/em&gt;. If the renter needs to be evicted, we will have ONLINE eviction forms ready to be filled out by landlords. There will be a section for suggested lawyers as well. Landlords can also pay an additional fee to have their properties show in the &lt;em&gt;Featured section&lt;/em&gt; for a certain period of time. More like Google does with paid links up top. For renters, everything is FREE. They can log in to their accounts and pay their rent dues ONLNE, see a history of all paid rent, due notices, save their preferred properties for later review or even contact landlords like they would in a social network environment. The interesting part of our website is how we let landlords upload their  properties and how we let them administer it. They can build a database  of properties by filling out a form. Landlords can then upload pictures  or choose not too. If a property is rented out, they do not need to  delete their property and re-do it again when it becomes available. They  just need to check it off the searches. That way, they can enter all  their properties and keep it for later exposure. On the landlords page,  they can choose default picture and delete specific ones.&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;strong&gt;Property Management&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;We also have plans to offer a section for Property Management people to upload their properties in bulks. Many property management businesses have rentals available. They usually advertise up front on the board.&lt;/p&gt;</description><link>http://ravigehlot.net/post/6081259360</link><guid>http://ravigehlot.net/post/6081259360</guid><pubDate>Wed, 01 Jun 2011 16:33:00 -0400</pubDate></item><item><title>Quick Syntax intro to Object Oriented Programming (OOP) with PHP</title><description>&lt;p&gt;This post is a quick reference from Chapter 6: Objects from &amp;#8220;Programming PHP&amp;#8221; a book published by O&amp;#8217;REILLY and authored by Rasmus Lerdorf, Kevin Tatroe &amp;amp; Peter MacIntyre. It&amp;#8217;s the 2nd Edition and it covers PHP5.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Why use Object Oriented Programming (OOP)?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Because it opens the door to cleaner designs, easier maintenance, and greater code re-useability. OOP acknowledges the fundamental connection between data and the code that works on that data, and it lets you design and implement programs around that connection. In a procedural programming language, each user would be a data structure, and there would probably be a set of functions that work with users&amp;#8217; data structures. In a object oriented programming language, each user would be an object&amp;#8212;a data structure with attached code. The data and the code are still there, but they are treated as an inseparable unit. The object, as union of code and data, is the modular unit for application development and code reuse.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;What is an object?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;An object is an instance of a class. In this case, it&amp;#8217;s an actual user data structure with attached code. Objects and classes are a bit like values and data types. There is only one integer data type, but there are many possible integers. Similarly, your program defines only one user class but can create many different (or identical) users from it. The data associated with an object are called its properties. The functions associated with an object are called its methods. When you define a class, you define the names of its properties and give the code for its methods.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;How to create an object?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;$object = new Class;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;How to access properties and methods?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;$object-&amp;gt;propertyName;&lt;/p&gt;
&lt;p&gt;$object-&amp;gt;methodName(arg1, arg2&amp;#8230;);&lt;/p&gt;
&lt;p&gt;HTML::p(&amp;#8220;Hello, world&amp;#8221;); // this is how to access a static method&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;How to declare a class, a property and a method?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;class className [ extends baseclass ] {&lt;/p&gt;
&lt;p&gt;     $propertyName = value;&lt;/p&gt;
&lt;p&gt;     function methodName(args) { // code }&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;How to declare constants?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;class paymentMethod {&lt;/p&gt;
&lt;p&gt;     const NUMBER = 1;&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;echo paymentMethod::NUMBER;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;How to use inheritance?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;To inherit the properties and methods from another class, use the extends keyword in the class definition, followed by the name of the base class:&lt;/p&gt;
&lt;p&gt;class Person {&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;class Employee extends Person {&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;What are interfaces and how to declare them?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Interfaces provide a way for defining contracts to which a class adheres; the interface provides method prototypes and constants, and any class which implements the interface must provide implementations for all methods in the interface. Here&amp;#8217;s the syntax for an interface definition:&lt;/p&gt;
&lt;p&gt;interface interfaceName {&lt;/p&gt;
&lt;p&gt;   function functionName();&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;interface Printable {&lt;/p&gt;
&lt;p&gt;   function printOutput();&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;class imageContent implements Printable {&lt;/p&gt;
&lt;p&gt;   function printOutput() {&lt;/p&gt;
&lt;p&gt;        echo &amp;#8220;print this&amp;#8221;;&lt;/p&gt;
&lt;p&gt;   }&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;What is an abstract class?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;PHP also provides a mechanism for declaring that certain methods on the class must be implemented by subclasses &amp;#8212; the implementation of those methods is not defined in the parent class. In these cases, you provide an abstract method; in addition, if a class has any methods in it defined as abstract, you must also declare the class as an abstract class.&lt;/p&gt;
&lt;p&gt;abstract class component {&lt;/p&gt;
&lt;p&gt;   abstract function printOutput();&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;class imageComponent extends component {&lt;/p&gt;
&lt;p&gt;   function printOutput() {&lt;/p&gt;
&lt;p&gt;       echo &amp;#8220;pretty picture&amp;#8221;;&lt;/p&gt;
&lt;p&gt;   }&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;Abstract classes cannot be instantiated. Also note that unlike some languages, you cannot provide a default implementation for abstract methods.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;What is a constructor?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Quite simple. A constructor will run automatically after a class has been instantiated. So basically, you don&amp;#8217;t need to call constructor. It executes it right after the instantiation is complete.&lt;/p&gt;
&lt;p&gt;class Person {&lt;/p&gt;
&lt;p&gt;    function __constructor($name, $age) {&lt;/p&gt;
&lt;p&gt;         $this-&amp;gt;name = $name;&lt;/p&gt;
&lt;p&gt;         $this-&amp;gt;age = $age;&lt;/p&gt;
&lt;p&gt;    }&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;What are destructors?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;When an object is destroyed, such as when the last reference to an object is removed or the end of the script is reached, its destructor is called. PHP automatically cleans up resources at the end of script&amp;#8217;s execution.&lt;/p&gt;
&lt;p&gt;class building {&lt;/p&gt;
&lt;p&gt;     function __destruct() {&lt;/p&gt;
&lt;p&gt;         echo &amp;#8220;A building is being destroyed!&amp;#8221;;&lt;/p&gt;
&lt;p&gt;     }&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;What is introspection?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Introspection is the ability of a program to examine an object&amp;#8217;s characteristics, such as its name, parent class(if any), properties, and methods. With introspection, you can write code that operates on any class or object. You don&amp;#8217;t need to know which methods or properties are defined when you write your code; instead, you can discover  that information at runtime, which makes it possible for you to write generic debuggers, serializes, profilers, etc.&lt;/p&gt;
&lt;p&gt;- Examining Classes&lt;/p&gt;
&lt;p&gt;To determine whether a class exists or not, use the class_exists() function, which takes in a string and returns a Boolean value. Alternatively, you can use get_declared_classes() function, which returns an array of defined classes and checks if the class name is in the returned array:&lt;/p&gt;
&lt;p&gt;$yes_no = class_exists(className);&lt;/p&gt;
&lt;p&gt;$classes = get_declared_classes();&lt;/p&gt;
&lt;p&gt;You can get the methods and properties that exist in a class (including those that are inherited from superclasses) using the get_class_methods() and get_class_vars() functions. These functions take a class name and return an array:&lt;/p&gt;
&lt;p&gt;$methods = get_class_methods(className);&lt;/p&gt;
&lt;p&gt;$properties = get_class_vars(className);&lt;/p&gt;
&lt;p&gt;- Examining an Object&lt;/p&gt;
&lt;p&gt;To get the class to which an object belongs, first make sure it is an object using the is_object() function, and then get the class with the get_class() function:&lt;/p&gt;
&lt;p&gt;$yes_no = is_object(var);&lt;/p&gt;
&lt;p&gt;$className = get_class(object);&lt;/p&gt;
&lt;p&gt;Before calling a method on an object, you can assure that it exists using method_exists() function:&lt;/p&gt;
&lt;p&gt;$yes_no = method_exists(object, method);&lt;/p&gt;
&lt;p&gt;Just as get_class_vars() returns an array of properties for a class, get_object_vars() returns an array of properties set in an object:&lt;/p&gt;
&lt;p&gt;$array = get_object_vars(object);&lt;/p&gt;
&lt;p&gt;And just as get_class_vars() returns only those properties with default values, get_object_vars() returns only those properties that are set:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;What is Serialization?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Serializing an object means converting it to a bytestream representation that can be stored in a file. This is useful for persistent data; for example, PHP sessions automatically save and restore objects. Serialization in PHP is mostly automatic &amp;#8212; it requires little extra work from you, beyond calling the serialize() and unserialize() functions:&lt;/p&gt;
&lt;p&gt;$encoded = serialize(something);&lt;/p&gt;
&lt;p&gt;$something = unserialize(decoded);&lt;/p&gt;
&lt;p&gt;Serialization is most commonly used with PHP&amp;#8217;s sessions, which handle the serialization for you. All you need to do is tell PHP which variables to keep track of, and they are automatically preserved between visits to pages on your site. However, sessions are not the only use of serialization &amp;#8212; if you want to implement your own from of persistent objects, the serialize() and unserialize() functions are a natural choice.&lt;/p&gt;</description><link>http://ravigehlot.net/post/6077480410</link><guid>http://ravigehlot.net/post/6077480410</guid><pubDate>Wed, 01 Jun 2011 14:18:37 -0400</pubDate></item><item><title>NULL, NOT NULL and empty</title><description>&lt;p&gt;&lt;strong&gt;NULL, NOT NULL and empty&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;A database architect may choose to set database columns to either NULL or NOT NULL. Why is this important? Well, it is important because it may have an impact in how you write your SQL statements. If the columns are set to allow NULL then you do not have to list all your columns on your INSERT statements. That&amp;#8217;s because NULL means no need to insert a value. But if the columns are set to NOT NULL then you must write all your columns on your insert statements. On IF control structures, you may check against NULLS.  It is important to know that NULL means that no &amp;#8220;value&amp;#8221; is there. There is nothing in that container. &lt;em&gt;It is not even empty. It just does not exist.&lt;/em&gt; NULL means that it does not exist. You can set a field to empty by inserting an empty string. That would mean that something exists in that field (an empty space). It ceases to be nonexistent. It&amp;#8217;s now a string with zero characters. Indeed, empty and NULL are not the same thing.&lt;/p&gt;</description><link>http://ravigehlot.net/post/5981174142</link><guid>http://ravigehlot.net/post/5981174142</guid><pubDate>Sun, 29 May 2011 19:15:00 -0400</pubDate></item><item><title>PHP Arrays Ex. #1: Simple Array</title><description>&lt;p&gt;Let&amp;#8217;s brief a bit on Arrays before moving on into this question. Please read the question at &lt;a href="http://phpexercises.com/php-simple-array-exercise.html" target="_blank"&gt;http://phpexercises.com/php-simple-array-exercise.html&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;There are two types of Arrays in PHP:&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;Numerical Array or Index&lt;/li&gt;
&lt;li&gt;Associative Array&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;A Numerical or Indexed array will have numbers for it&amp;#8217;s keys. So for example, $a[0] = &amp;#8216;somebody&amp;#8217;, $a[1] = &amp;#8216;else&amp;#8217;, $a[2] = &amp;#8216;elsewhere&amp;#8217;. So in this example we have a numerical key starting from 0 all the way to the number 2. That&amp;#8217;s 3 records on the array. In the Associative Array, the key or indexer is a string and not a number. So an example would be something like $a[&amp;#8216;Ravi&amp;#8217;] = &amp;#8216;programmer&amp;#8217;, $a[&amp;#8216;Gehlot&amp;#8217;] = &amp;#8216;last name&amp;#8217;.&lt;/p&gt;
&lt;p&gt;In this exercise, we are going to build an Associate Array with the weather conditions listed out. The exercise did not specify weather to use numerical or associative. The code below is what I came up with for an associative array:&lt;/p&gt;
&lt;blockquote&gt;&amp;lt;?php&lt;br/&gt;$listWeatherConditions = array(&amp;#8216;rain&amp;#8217; =&amp;gt; &amp;#8216;rain&amp;#8217;&lt;br/&gt;                                ,    &amp;#8217;sunshine&amp;#8217; =&amp;gt; &amp;#8216;sunshine&amp;#8217;&lt;br/&gt;                                ,    &amp;#8217;clouds&amp;#8217; =&amp;gt; &amp;#8216;clouds&amp;#8217;&lt;br/&gt;                                ,    &amp;#8217;hail&amp;#8217; =&amp;gt; &amp;#8216;hail&amp;#8217;&lt;br/&gt;                                ,    &amp;#8217;sleet&amp;#8217; =&amp;gt; &amp;#8216;sleet&amp;#8217;&lt;br/&gt;                                ,    &amp;#8217;snow&amp;#8217; =&amp;gt; &amp;#8216;snow&amp;#8217;&lt;br/&gt;                                ,    &amp;#8217;wind&amp;#8217; =&amp;gt; &amp;#8216;wind&amp;#8217;&lt;br/&gt;                                );&lt;br/&gt;?&amp;gt;&lt;br/&gt;&amp;lt;!DOCTYPE html&amp;gt;&lt;br/&gt;&amp;lt;html&amp;gt;&lt;br/&gt;&amp;lt;head&amp;gt;&lt;br/&gt;      &amp;lt;title&amp;gt;My Weather Condition Array page&amp;lt;/title&amp;gt;&lt;br/&gt;&amp;lt;/head&amp;gt;&lt;br/&gt;&amp;lt;body&amp;gt;&lt;br/&gt;      &amp;lt;h3&amp;gt;My Weather Condition Array Page&amp;lt;/h3&amp;gt;&lt;br/&gt;&amp;lt;?php&lt;br/&gt;echo &amp;#8216;We&amp;#39;ve seen all kinds of weather this month. At the beginning of the month, we had &amp;#8217; . &lt;br/&gt;$listWeatherConditions[&amp;#8216;snow&amp;#8217;] . &amp;#8217; and &amp;#8217; . $listWeatherConditions[&amp;#8216;wind&amp;#8217;] . &amp;#8216;. Then came &amp;#8217; . &lt;br/&gt;$listWeatherConditions[&amp;#8216;sunshine&amp;#8217;] . &amp;#8217; with a few clouds and some &amp;#8217; . $listWeatherConditions[&amp;#8216;rain&amp;#8217;] . &lt;br/&gt;&amp;#8217;. At least we didn&amp;#39;t get any &amp;#8217; . $listWeatherConditions[&amp;#8216;hail&amp;#8217;] . &amp;#8217; or &amp;#8217; . $listWeatherConditions[&amp;#8216;sleet&amp;#8217;] . &amp;#8216;.&amp;#8217;;&lt;br/&gt;?&amp;gt;&lt;br/&gt;&amp;lt;/body&amp;gt;&lt;br/&gt;&amp;lt;/html&amp;gt;&lt;/blockquote&gt;
&lt;p&gt;The code below is what I came up with for a numerical array:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&amp;lt;?php&lt;br/&gt;$listWeatherConditions = array(&amp;#8216;rain&amp;#8217;, &amp;#8216;sunshine&amp;#8217;, &amp;#8216;clouds&amp;#8217;, &amp;#8216;hail&amp;#8217;, &amp;#8216;sleet&amp;#8217;, &amp;#8216;snow&amp;#8217;, &amp;#8216;wind&amp;#8217;);&lt;br/&gt;?&amp;gt;&lt;br/&gt;&amp;lt;!DOCTYPE html&amp;gt;&lt;br/&gt;&amp;lt;html&amp;gt;&lt;br/&gt;&amp;lt;head&amp;gt;&lt;br/&gt;      &amp;lt;title&amp;gt;My Weather Condition Array page&amp;lt;/title&amp;gt;&lt;br/&gt;&amp;lt;/head&amp;gt;&lt;br/&gt;&amp;lt;body&amp;gt;&lt;br/&gt;      &amp;lt;h3&amp;gt;My Weather Condition Array Page&amp;lt;/h3&amp;gt;&lt;br/&gt;&amp;lt;?php&lt;br/&gt;echo &amp;#8216;We&amp;#39;ve seen all kinds of weather this month. At the beginning of the month, we had &amp;#8217; . &lt;br/&gt;$listWeatherConditions[5] . &amp;#8217; and &amp;#8217; . $listWeatherConditions[6] . &amp;#8216;. Then came &amp;#8217; . &lt;br/&gt;$listWeatherConditions[1] . &amp;#8217; with a few clouds and some &amp;#8217; . $listWeatherConditions[0] . &lt;br/&gt;&amp;#8217;. At least we didn&amp;#39;t get any &amp;#8217; . $listWeatherConditions[3] . &amp;#8217; or &amp;#8217; . $listWeatherConditions[4] . &amp;#8216;.&amp;#8217;;&lt;br/&gt;?&amp;gt;&lt;br/&gt;&amp;lt;/body&amp;gt;&lt;br/&gt;&amp;lt;/html&amp;gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Go to &lt;a href="http://phpexercises.com/php-simple-array-exercise.html" target="_blank"&gt;http://phpexercises.com/php-simple-array-exercise.html&lt;/a&gt; to look at the original code answer from phpexercises.com. What I like about their code is that they took the time to write code comments. Comments are part of good code standards.&lt;/p&gt;</description><link>http://ravigehlot.net/post/5883268075</link><guid>http://ravigehlot.net/post/5883268075</guid><pubDate>Thu, 26 May 2011 21:11:00 -0400</pubDate></item><item><title>A few things about the ZEND Certification exam</title><description>&lt;p&gt;In the study guide, they mention that REGISTER_GLOBALS and MAGIC_QUOTES_GPC must be set to off. So let&amp;#8217;s go over what those are and why they might have wanted it to be set to off.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;REGISTER_GLOBALS&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;    If OFF, *no* variables passed from $_GET, $_POST and $_COOKIES will be created in the global namespace. Here is an excerpt from IBM&amp;#8217;s website:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;register_globals&lt;/code&gt; is not, in and of itself, a security  hazard. It does, however, make it harder to trace user input and harder  to make sure your application is secure. Why does it do this? Because if  &lt;code&gt;register_globals&lt;/code&gt; is on, any variable passed to the PHP script by &lt;code&gt;GET&lt;/code&gt;, &lt;code&gt;POST&lt;/code&gt;, and &lt;code&gt;COOKIE&lt;/code&gt; will be created in the global namespace, as well as in the &lt;code&gt;$_GET&lt;/code&gt;, &lt;code&gt;$_POST&lt;/code&gt;, or &lt;code&gt;$_COOKIE&lt;/code&gt; arrays.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;When is this useful or not? I don&amp;#8217;t quite understand it. Any input is welcome.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;MAGIC_QUOTES_GPC&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;     According to the PHP manual, magic_quotes_gpc() sets the state for GPC (Get/Post/Cookie)       operations.  When magic_quotes_gpc() is ON, all &amp;#8217; (single-quote),       &amp;#8221; (double quote), \ (backslash) and NUL&amp;#8217;s are escaped       with a backslash automatically. With magic_quotes_gpc() OFF, you have to learn about the addslashes() and stripslashes() functions in order to escape data yourself. However, the zend study guide doesn&amp;#8217;t mention anything about data that comes from a database like MySQL or even an external script executed by exec(). For database, if magic_quotes_runtime is ON then data coming from the DB will be escaped. There might be a question on the exam about data coming from the database. That data would be escaped.&lt;/p&gt;</description><link>http://ravigehlot.net/post/5871031091</link><guid>http://ravigehlot.net/post/5871031091</guid><pubDate>Thu, 26 May 2011 14:41:00 -0400</pubDate></item><item><title>PHP Array question number #6 from phpexercises.com</title><description>&lt;p&gt;There is a famous quote on practice that goes like this &amp;#8220;Practice is the best of all instructors&amp;#8221;. Practice is the best way to learn. In this post, we will solve a question from &lt;a href="http://phpexercises.com/php-manipulate-array-exercise.html" target="_blank"&gt;http://phpexercises.com/php-manipulate-array-exercise.html&lt;/a&gt; titled &amp;#8220;PHP Arrays Ex. #6: Manipulate the Array&amp;#8221;. I came up with my own version and then I compared it to what they had come up with. Then I went further into making it more presentable by changing a few things. Let&amp;#8217;s go over it. First read the question from the website.&lt;/p&gt;
&lt;p&gt;They want you to choose a spring month because spring months have 30 days. However, does this really matter? No. Why? Well, we know for sure that have 30 days to work with. That is all we need to worry about. You don&amp;#8217;t have specify any month on your script. It&amp;#8217;s just information to try to complicate more. Most questions become tricky when they try to throw useless information. To simplify it, don&amp;#8217;t worry about Celsius temps. Just keep it simple. The temps are already in Fahrenheit so keep it that way. We already ruled out 2 pieces of unnecessary information. No month, no Celsius. The key to solving this problem lies on the second paragraph. You need to compute the average of all high temps. Remember, all of those temps are HIGH temps.  So to calculate the mean value(average) sum them up and divide by 30. Next, find the 5 warmest temps and the 5 coolest temps. You got 3 tasks to do on this question. Before coding, take a pen and a paper and do some brainstorming. I wrote down all the numbers that they mentioned on the question. I computed the average and then I re-arranged the values so that I could better see which ones were the highest numbers(warmest) and which ones were the lowest numbers(coolest). So right off the bat, you have the first answer. All you got to do is add and divide to get the average. Then for the other 2 answers, re-arrange(sort) the array so that you can pick the 5 lowest and 5 warmest temps. Job Done. After the initial brainstorming, we go into actual coding.&lt;/p&gt;
&lt;p&gt;The code explains it all so take a look. If you don&amp;#8217;t know what the functions do then consult the PHP manual. This is what I came up with on my own:&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;&amp;lt;?php&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;/*&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;PHP Arrays Ex. #6: Manipulate the Array&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;In this PHP exercise, you will create an array of temperatures. Choose a spring month to have a wider range of &lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;temperatures to handle. We&amp;#8217;ll use 30 days of the month. The exercise is generic, but feel free to use a specific &lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;month in your own script. The answer script will use the Fahrenheit scale, but again feel free to use Celsius if you prefer.&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;Create your array of 30 high temperatures, approximating the weather for a spring month, then find the average &lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;high temp, the five warmest high temps and the five coolest high temps. Print your findings to the browser.&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;Hint: the HTML character entity for the degree sign is &amp;amp;deg;.&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;Feel free to make up the temps or gather data for your own area. Here&amp;#8217;s a list of thirty Fahrenheit high temperatures &lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;you can use if you like:&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;68, 70, 72, 58, 60, 79, 82, 73, 75, 77, 73, 58, 63, 79, 78,&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;68, 72, 73, 80, 79, 68, 72, 75, 77, 73, 78, 82, 85, 89, 83&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;*/&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;// Create an array of temperatures for the month of March&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;$monthTemp = array(68, 70, 72, 58, 60, 79, 82, 73, 75, 77, 73, 58, 63, 79, 78, 68, 72, 73, 80, 79, 68, 72, 75, 77, 73, 78, 82, 85, 89, 83);&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;// Finding the average for high temp. Take all numbers and do the average.&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;    $count = count($monthTemp);&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;    $total = 0;&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;    for($a = 0; $a &amp;lt; $count; $a++) {&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;        $sum = $monthTemp[$a] . &amp;#8216;&amp;lt;br /&amp;gt;&amp;#8217;;&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;        $total += $sum;&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;    }&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;    $average = $total / $count;&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;    echo &amp;#8216;The average for high temp is &amp;#8217; . $average . &amp;#8217; &amp;amp;deg;F or &amp;#8217; . round($average) . &amp;#8217; &amp;amp;deg;F&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;#8217;;&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;// The five warmest high temps. 80, 82, 83, 85, 89. We know that the highest temperature is 89.&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;    // We sort the array to have the last 5 numbers be the warmest high temps.&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;    sort($monthTemp);&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;    &lt;br/&gt;&lt;em&gt;&lt;strong&gt;    // pop last 5 keys&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;    $highTemp5 = array_pop($monthTemp);&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;    $highTemp4 = array_pop($monthTemp);&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;    $highTemp3 = array_pop($monthTemp);&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;    $highTemp2 = array_pop($monthTemp);&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;    $highTemp1 = array_pop($monthTemp);&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;    &lt;br/&gt;&lt;em&gt;&lt;strong&gt;    echo &amp;#8216;The five warmest high temps are: &amp;#8217; . $highTemp5 . &amp;#8216;&amp;amp;deg;F, &amp;#8217; . $highTemp4 . &amp;#8216;&amp;amp;deg;F, &amp;#8217; . $highTemp3 . &amp;#8216;&amp;amp;deg;F, &amp;#8217; . $highTemp2 . &amp;#8216;&amp;amp;deg;F, &amp;#8217; . $highTemp1 . &amp;#8216;&amp;amp;deg;F&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;#8217;;&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;// The five coolest high temps.     &lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;    $coolestTemp5 = array_shift($monthTemp);&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;    $coolestTemp4 = array_shift($monthTemp);&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;    $coolestTemp3 = array_shift($monthTemp);&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;    $coolestTemp2 = array_shift($monthTemp);&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;    $coolestTemp1 = array_shift($monthTemp);&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;    &lt;br/&gt;&lt;em&gt;&lt;strong&gt;    echo &amp;#8216;The five coolest high temps are: &amp;#8217; . $coolestTemp5 . &amp;#8216;&amp;amp;deg;F, &amp;#8217; . $coolestTemp4 . &amp;#8216;&amp;amp;deg;F, &amp;#8217; . $coolestTemp3 . &amp;#8216;&amp;amp;deg;F, &amp;#8217; . $coolestTemp2 . &amp;#8216;&amp;amp;deg;F, &amp;#8217; . $coolestTemp1 . &amp;#8216;&amp;amp;deg;F&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;#8217;;&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;?&amp;gt;&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;A bit more complicated than the original answer but I was able to get to the same answer like they did. Now look at the original answer from their site and compare it to mine:&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;&amp;lt;!DOCTYPE html PUBLIC &amp;#8220;-//W3C//DTD XHTML 1.0 Transitional//EN&amp;#8221;&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;     &amp;#8220;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&amp;#8221;&amp;gt;&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt; &lt;br/&gt;&lt;em&gt;&lt;strong&gt;&amp;lt;html xmlns=&amp;#8221;http://www.w3.org/1999/xhtml&amp;#8221;  xml:lang=&amp;#8221;en&amp;#8221; lang=&amp;#8221;en&amp;#8221;&amp;gt;&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;&amp;lt;head&amp;gt;&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;&amp;lt;meta http-equiv=&amp;#8221;content-type&amp;#8221; content=&amp;#8221;text/html;charset=iso-8859-1&amp;#8221; /&amp;gt;&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;&amp;lt;title&amp;gt;High Temperatures Array&amp;lt;/title&amp;gt;&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;&amp;lt;/head&amp;gt;&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt; &lt;br/&gt;&lt;em&gt;&lt;strong&gt;&amp;lt;body&amp;gt;&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;&amp;lt;h2&amp;gt;High Temperatures for Spring Month&amp;lt;/h2&amp;gt;&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt; &lt;br/&gt;&lt;em&gt;&lt;strong&gt;&amp;lt;?php&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;//Create an array of 30 Fahrenheit high temperatures for a spring month.&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;$highTemps = array(&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;  68, 70, 72, 58, 60, 79, 82, 73, 75, 77, 73, 58, 63, 79, 78,&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;  68, 72, 73, 80, 79, 68, 72, 75, 77, 73, 78, 82, 85, 89, 83&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;);&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt; &lt;br/&gt;&lt;em&gt;&lt;strong&gt;//Get number of temps.&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;$count = count($highTemps);&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt; &lt;br/&gt;&lt;em&gt;&lt;strong&gt;//Get a total of all temps.&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;$total = 0;&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;foreach ($highTemps as $h){&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;  $total += $h;&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;}&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt; &lt;br/&gt;&lt;em&gt;&lt;strong&gt;//Calculate average.&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;$avg = round($total / $count);&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt; &lt;br/&gt;&lt;em&gt;&lt;strong&gt;//Send data to the browser. &amp;amp;deg; is the ASCII code for the degree sign.&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;echo &amp;#8220;&amp;lt;p&amp;gt;The average high temperature for the month was $avg &amp;amp;deg;F.&amp;lt;/p&amp;gt;\n&amp;#8221;;&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt; &lt;br/&gt;&lt;em&gt;&lt;strong&gt;//Sort the temps and get the top and bottom five.&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;//Use rsort to produce a descending sort.&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;rsort($highTemps);&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;//Pull out the top 5 temps.&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;$topTemps = array_slice($highTemps, 0, 5);&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;echo &amp;#8220;&amp;lt;p&amp;gt;The warmest five high temperatures were: &amp;lt;br /&amp;gt;\n&amp;#8221;;&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;foreach($topTemps as $t){&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;  echo &amp;#8220;$t &amp;amp;deg;F &amp;lt;br/&amp;gt; \n&amp;#8221;;&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;}&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;echo &amp;#8220;&amp;lt;/p&amp;gt;&amp;#8221;;&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;   &lt;br/&gt;&lt;em&gt;&lt;strong&gt;//Pull out the bottom five temps.&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;$lowTemps = array_slice($highTemps, -5, 5);&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;echo &amp;#8220;&amp;lt;p&amp;gt;The coolest five high temperatures were: &amp;lt;br/&amp;gt;\n&amp;#8221;;&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;foreach($lowTemps as $l){&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;  echo &amp;#8220;$l &amp;amp;deg;F &amp;lt;br/&amp;gt; \n&amp;#8221;;&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;}&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;echo &amp;#8220;&amp;lt;/p&amp;gt;&amp;#8221;;&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt; &lt;br/&gt;&lt;em&gt;&lt;strong&gt;?&amp;gt;&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt; &lt;br/&gt;&lt;em&gt;&lt;strong&gt;&amp;lt;/body&amp;gt;&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;&amp;lt;/html&amp;gt; &lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;In trying to play with it and further my knowledge, I got rid of duplicates keys from the array, added averages for the 5 warmest and coolest temps and then made sure that the coolest temps printed ascending rather. But remember, this is not exactly what they asked of you to do. So it would have been wrong to give this as an answer.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;&amp;lt;?php&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;/*&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;PHP Arrays Ex. #6: Manipulate the Array&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;In this PHP exercise, you will create an array of temperatures. Choose a spring month to have a wider range of &lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;temperatures to handle. We&amp;#8217;ll use 30 days of the month. The exercise is generic, but feel free to use a specific &lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;month in your own script. The answer script will use the Fahrenheit scale, but again feel free to use Celsius if you prefer.&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;Create your array of 30 high temperatures, approximating the weather for a spring month, then find the average &lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;high temp, the five warmest high temps and the five coolest high temps. Print your findings to the browser.&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;Hint: the HTML character entity for the degree sign is &amp;amp;deg;.&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;Feel free to make up the temps or gather data for your own area. Here&amp;#8217;s a list of thirty Fahrenheit high temperatures &lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;you can use if you like:&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;68, 70, 72, 58, 60, 79, 82, 73, 75, 77, 73, 58, 63, 79, 78,&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;68, 72, 73, 80, 79, 68, 72, 75, 77, 73, 78, 82, 85, 89, 83&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;*/&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;// Create an array of temperatures for the month of March&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;$monthTemp = array(68, 70, 72, 58, 60, 79, 82, 73, 75, 77, 73, 58, 63, 79, 78, 68, 72, 73, 80, 79, 68, 72, 75, 77, 73, 78, 82, 85, 89, 83);&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;// Finding the average for high temp. Take all numbers and do the average.&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;    $count = count($monthTemp);&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;    $total = 0;&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;    for($a = 0; $a &amp;lt; $count; $a++) {&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;        $sum = $monthTemp[$a] . &amp;#8216;&amp;lt;br /&amp;gt;&amp;#8217;;&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;        $total += $sum;&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;    }&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;    $average = $total / $count;&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;    echo &amp;#8216;The average for high temp is &amp;#8217; . $average . &amp;#8217; &amp;amp;deg;F or &amp;#8217; . round($average) . &amp;#8217; &amp;amp;deg;F&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;#8217;;&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;// The five warmest high temps. 80, 82, 83, 85, 89. We know that the highest temperature is 89.&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;    // We sort the array to have the last 5 numbers be the warmest high temps.&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;    sort($monthTemp);&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;    &lt;br/&gt;&lt;em&gt;&lt;strong&gt;    // We get rid of duplicated    &lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;    $noDuplicates = array_unique($monthTemp);&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;    // pop last 5 keys&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;    $highTemp5 = array_pop($noDuplicates);&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;    $highTemp4 = array_pop($noDuplicates);&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;    $highTemp3 = array_pop($noDuplicates);&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;    $highTemp2 = array_pop($noDuplicates);&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;    $highTemp1 = array_pop($noDuplicates);&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;    &lt;br/&gt;&lt;em&gt;&lt;strong&gt;    echo &amp;#8216;The five warmest high temps are: &amp;#8217; . $highTemp5 . &amp;#8216;&amp;amp;deg;F, &amp;#8217; . $highTemp4 . &amp;#8216;&amp;amp;deg;F, &amp;#8217; . $highTemp3 . &amp;#8216;&amp;amp;deg;F, &amp;#8217; . $highTemp2 . &amp;#8216;&amp;amp;deg;F, &amp;#8217; . $highTemp1 . &amp;#8216;&amp;amp;deg;F&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;#8217;;&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;    $warmestAverage = ($highTemp5 + $highTemp4 + $highTemp3 + $highTemp2 + $highTemp1) / 5;&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;    echo &amp;#8216;The average of the five warmest high temps are: &amp;#8217; . $warmestAverage . &amp;#8217; &amp;amp;deg;F or &amp;#8217; . round($warmestAverage) . &amp;#8217; &amp;amp;deg;F&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;#8217;;&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;// The five coolest high temps.     &lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;    $coolestTemp5 = array_shift($noDuplicates);&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;    $coolestTemp4 = array_shift($noDuplicates);&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;    $coolestTemp3 = array_shift($noDuplicates);&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;    $coolestTemp2 = array_shift($noDuplicates);&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;    $coolestTemp1 = array_shift($noDuplicates);&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;    &lt;br/&gt;&lt;em&gt;&lt;strong&gt;    echo &amp;#8216;The five coolest high temps are: &amp;#8217; . $coolestTemp5 . &amp;#8216;&amp;amp;deg;F, &amp;#8217; . $coolestTemp4 . &amp;#8216;&amp;amp;deg;F, &amp;#8217; . $coolestTemp3 . &amp;#8216;&amp;amp;deg;F, &amp;#8217; . $coolestTemp2 . &amp;#8216;&amp;amp;deg;F, &amp;#8217; . $coolestTemp1 . &amp;#8216;&amp;amp;deg;F&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;#8217;;&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;    $coolestAverage = ($coolestTemp5 + $coolestTemp4 + $coolestTemp3 + $coolestTemp2 + $coolestTemp1) / 5;&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;    echo &amp;#8216;The average of the five warmest high temps are: &amp;#8217; . $coolestAverage . &amp;#8217; &amp;amp;deg;F or &amp;#8217; . round($coolestAverage) . &amp;#8217; &amp;amp;deg;F&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;#8217;;&lt;/strong&gt;&lt;/em&gt;&lt;br/&gt;&lt;em&gt;&lt;strong&gt;?&amp;gt;&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;</description><link>http://ravigehlot.net/post/5869515916</link><guid>http://ravigehlot.net/post/5869515916</guid><pubDate>Thu, 26 May 2011 13:34:00 -0400</pubDate></item><item><title>FREE PHP Quizzes</title><description>&lt;p&gt;If you know of any good FREE PHP quizzes please post a comment with a link to it.&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;a href="http://www.myphpquiz.com/" target="_blank"&gt;http://www.myphpquiz.com/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://phpexercises.com/" target="_blank"&gt;http://phpexercises.com/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.w3schools.com/php/php_quiz.asp" target="_blank"&gt;http://www.w3schools.com/php/php_quiz.asp&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description><link>http://ravigehlot.net/post/5841266595</link><guid>http://ravigehlot.net/post/5841266595</guid><pubDate>Wed, 25 May 2011 16:23:15 -0400</pubDate></item><item><title>Bitwise Operators: Studying for the ZEND PHP Certification</title><description>&lt;p&gt;I was going to write a post on Bitwise Operators but I found a really good article written by Jim Plush that can be found at &lt;a href="http://www.litfuel.net/tutorials/bitwise.htm" target="_blank"&gt;http://www.litfuel.net/tutorials/bitwise.htm&lt;/a&gt; He couldn&amp;#8217;t have explained any better.&lt;/p&gt;</description><link>http://ravigehlot.net/post/5840468637</link><guid>http://ravigehlot.net/post/5840468637</guid><pubDate>Wed, 25 May 2011 15:55:00 -0400</pubDate></item><item><title>Recruiter asked me to take an ONLINE assessment test in PHP</title><description>&lt;p&gt;Today I took an ONLINE assessment test in PHP from &lt;span class="tl"&gt;&lt;/span&gt;&lt;span class="l noline"&gt;&lt;em&gt;Proveit2&lt;/em&gt;&lt;/span&gt;&lt;span class="l noline"&gt;.com&lt;/span&gt;(Kenexa Prove It! Skills Assessments). All questions were multiple choice questions with only one possible correct answer. I enjoy taking those assessments exams because it is another way to learn. On this post, I will try to comment on the test (what I can remember of it).&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;in_array()&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;    This function checks if a value exists on an array. If it finds a value, it returns boolean TRUE. If nothing is found, it returns boolean FALSE. The function itself is self-explanatory. The way that I like to remember this function is by asking myself the question &amp;#8220;Is it in_array()?&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;PHP Magic Quotes&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;    Magic quotes, if enabled, will escape backslashes, double quotes and single quotes automatically. I know about Magic Quotes because I have been studying for the Zend PHP Certification; one of their requirements is that magic_quotes_gpc must be disabled. If enabled, Magic Quotes will automatically escape any incoming data like form submission. Magic Quotes is DEPRECATED according to the PHP manual. Another question on the exam had to do with how to strip out quotes. I am pretty sure that I got that one wrong because I was confused between the stripslashes() and addslashes() functions. The former is used to un-quote a quoted string while addslashes() will function the same way as PHP Magic Quotes.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;ucwords()&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;    There can be no doubt as to what this function does. I mean, UC. stands for UpperCase and the plural of words gave it away that it had to uppercase more than one letter. For what I can remember, the tricky part of this question was the other functions in the multiple choice answers. They looked kind of similar but I shot for what seemed more appropriate. In all honest, I didn&amp;#8217;t quite remember this one. It was a guess. Unlike strtoupper() that is used to uppercase an entire string, ucwords() will uppercase the first letter of each given word.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;session_start() headers&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;    session_start() will initialize session data and send out several HTTP headers depending on the     configuration. &lt;span class="function"&gt;session_cache_limiter() &lt;/span&gt;can be used to control the following major headers Expires, Pragma and Content-Type. There are several other headers as well. The test concentrated in the above headers. For example, a session can be expired by sending a Expires header to the client causing him/her to log out. With the header Cache-Control one can allow/disallow the client to save information.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;session_name()&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;   The session can be renamed using session_name() but it must be called before starting session_start(). Basically, you can rename a session and then expire the old one. I think that renaming it can avoid conflict. I never needed to rename a session so I am not sure how this would be useful.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;lcfirst()&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;   &lt;span class="dc-title"&gt;Makes a string&amp;#8217;s first character lowercase unlike strtolower() which lowercase the entire string. Again, the function is self-explanatory. lcfirst() stand for lower-case-only-first-character.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class="dc-title"&gt;&lt;strong&gt;namespace identifier&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class="dc-title"&gt;    I have no experience with namespaces. But from looking at the answers, I could tell that this causes an error or warning. I took a good guess on this one. After the exam, I looked it up on the Internet and fair enough it does cause an error. But I do have to research on this one. All multiple choices answers had errors or warnings.&lt;br/&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class="dc-title"&gt;&lt;strong&gt;goto&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class="dc-title"&gt;   They gave a class with a method called goto. This would never work because goto is a reserved word. It&amp;#8217;s a well known reserved word.&lt;br/&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class="dc-title"&gt;&lt;strong&gt;extension_loaded()&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class="dc-title"&gt;   It is possible to find out which extensions are loaded with using this function. However, I prefer phpinfo() because not only do you get to see your extensions but also almost every other important information.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;span class="dc-title"&gt;REST&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class="dc-title"&gt;   &lt;/span&gt;&lt;span class="dc-title"&gt;This question asked what REST returned. It is XML, JSON.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;span class="dc-title"&gt;constant table&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class="dc-title"&gt;    &lt;/span&gt;&lt;span class="dc-title"&gt;A constant table is a table that is:&lt;/span&gt;&lt;/p&gt;
&lt;ol&gt;&lt;li&gt;&lt;span class="dc-title"&gt;empty.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class="dc-title"&gt;has 1 row.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class="dc-title"&gt;a table that is used with the WHERE clause on an UNIQUE index or PRIMARY KEY where all INDEX parts are used in constant expressions and the index parts are defined as NOT NULL.&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;p&gt;&lt;strong&gt;array_unique()&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;    This function will look for all duplicates and return a new array without any duplicated.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;xml_parse_into_struct()&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;    This function is very much used. &lt;span class="dc-title"&gt;Parse XML data into an array structure.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class="dc-title"&gt;&lt;strong&gt;mysql_field_seek()&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class="dc-title"&gt;    I never used it but it&amp;#8217;s kind logical to think that it will seek a field in an array. Why? Well, mysql returns an array; arrays work with offsets. So logically this function had to seek an offset field. Now what it does with it or what not. That I have to look it up later.&lt;strong&gt;&lt;br/&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class="dc-title"&gt;&lt;strong&gt;number_format()&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class="dc-title"&gt;   This function will take a number and place commas where applies. So for example. If I give it 124987234, it should return 124,987,234.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class="dc-title"&gt;&lt;strong&gt;round()&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class="dc-title"&gt;   In the exam, they wanted to know how to round down a number. In the multiple choice answers they had all kind of functions like round_down() and roundDown() so it was confusing. I chose round() because it was what I knew. In fact, round() will round it up or down. To my knowledge, there is no other function to do the same thing.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class="dc-title"&gt;&lt;strong&gt;SOAP __doRequest&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class="dc-title"&gt;   The question had to do with what method performs a request when using SOAP. the answer was __doRequest. This was another good guess.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class="dc-title"&gt;&lt;strong&gt;E_NOTICE&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class="dc-title"&gt;   This predefined constant will return run-time errors only. The function error_reporting() takes logical operators to return errors. So you can return E_NOTICE &amp;amp; E_ALL among other errors. This was easy!&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class="dc-title"&gt;&lt;strong&gt;substr() and strpos()&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class="dc-title"&gt;   I used a little bit of common sense on this question. substr() takes 3 parameters. That much I knew. So one of the answers was already cut out. Also the last 2 parameters of substr() takes only numbers. The second parameter is for position and the third one for length. With strpost(), we can can find the position. So with that, I ruled out another answer that had strpost() for length. With the 2 answers remaining, the length count for &amp;#8220;true&amp;#8221; could only be 4. I went for that answer.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class="dc-title"&gt;&lt;strong&gt;date()&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class="dc-title"&gt;   This question shouldn&amp;#8217;t have been there in the first place. The reason why I say this is because it&amp;#8217;s a little too much to expect that a person can remember all the possible variations of lowercase and uppercase letters that when put together can give you the date specified. One thing I kind of noticed from working with date() is that usually lowercase letters represent numbers while uppercase letters represent strings. So I kind of took an estimated guess on this one.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class="dc-title"&gt;&lt;strong&gt;strtotime() and idate()&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class="dc-title"&gt;    strtotime formats a date into number seconds. This is what we call UNIX timestamp format. With idate(), you can take an UNIX timestamp and return an integer number. I never used UNIX timestamps let alone idate. So I probably got this one wrong.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class="dc-title"&gt;&lt;strong&gt;modulus operator&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class="dc-title"&gt;    There was a question with a modulus operator. Basically, they gave two integers and they asked for the result modulus of it. The result was 6. The modulus operator gives the reminder.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class="dc-title"&gt;&lt;strong&gt;error control @ operator&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class="dc-title"&gt;    This operator suppresses any errors that may occur. So for example, in the test they had a variable inside of a string but that variable did not exist. it hadn&amp;#8217;t been declared and set. Without the error control operator, it would have returned an error instead. But with the operator it suppresses the error and still prints part of the expression. &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class="dc-title"&gt;&lt;strong&gt;array_pop() and implode()&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class="dc-title"&gt;array_pop() was a tricky one because I never used it. I didn&amp;#8217;t know it existed. So I took a guess on this one. But array_pop() will pop the last element of an array. implode() will join elements.&lt;strong&gt;&lt;br/&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;</description><link>http://ravigehlot.net/post/5839854920</link><guid>http://ravigehlot.net/post/5839854920</guid><pubDate>Wed, 25 May 2011 15:33:00 -0400</pubDate></item><item><title>"Choose a job you love, and you will never have to work a day in your life.
Confucius"</title><description>“Choose a job you love, and you will never have to work a day in your life.&lt;br/&gt;
Confucius”</description><link>http://ravigehlot.net/post/4668752891</link><guid>http://ravigehlot.net/post/4668752891</guid><pubDate>Sat, 16 Apr 2011 16:42:55 -0400</pubDate></item></channel></rss>

