<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Search-This &#187; Yahoo</title>
	<atom:link href="http://www.search-this.com/category/yahoo/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.search-this.com</link>
	<description>Internet Marketing, Website Promotion and Blogging Advice</description>
	<lastBuildDate>Mon, 01 Mar 2010 21:09:20 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Yahoo Job Interview Questions: Part 2</title>
		<link>http://www.search-this.com/2007/08/27/yahoo-job-interview-questions-part-2/</link>
		<comments>http://www.search-this.com/2007/08/27/yahoo-job-interview-questions-part-2/#comments</comments>
		<pubDate>Mon, 27 Aug 2007 13:04:22 +0000</pubDate>
		<dc:creator>cpradio</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Yahoo]]></category>

		<guid isPermaLink="false">http://www.search-this.com/2007/08/27/yahoo-job-interview-questions-part-2/</guid>
		<description><![CDATA[If you read 'Yahoo Job Interview Questions: Part 1' because you were interested in the answers to their questions, then you will definitely be interested in Part 2; which answers questions 12 through 22.
So let's get started!
Questions 12 - 22


What is the difference between include, include_once? and require?
All three allow the script to include another [...]]]></description>
			<content:encoded><![CDATA[<p><strong>If you read '<a href="http://www.search-this.com/2007/08/13/yahoo-job-interview-questions-part-1/">Yahoo Job Interview Questions: Part 1</a>' because you were interested in the answers to their questions, then you will definitely be interested in Part 2; which answers questions 12 through 22.</strong></p>
<p>So let's get started!</p>
<p><strong>Questions 12 - 22</strong></p>
<ol start='12'>
<li>
<h3>What is the difference between include, include_once? and require?</h3>
<p>All three allow the script to include another file, be it internal or external depending on if allow_url_fopen is enabled.  However, they do have slight differences, which are denoted below.</p>
<ol>
<li>             <code>include()</code><br />
The include() function allows you to include a file multiple times within your application and if the file does not exist it will throw a Warning and continue on with your PHP script.</li>
<li>             <code>include_once()</code><br />
include_once() is like include() except as the name suggests, it will only include the file once during the script execution.</li>
<li>             <code>require()</code><br />
Like include(), you can request to require a file multiple times, however, if the file does not exist it will throw a Warning that will result in a Fatal Error stopping the PHP script execution.</li>
</ol>
</li>
<li>
<h3>What function would you use to redirect the browser to a new page?</h3>
<ol>
<li>             <code>redir()</code><br />
This is not a function in PHP, so it will fail with an error.</li>
<li>             <code>header()</code><br />
This is the correct function, it allows you to write header data to direct the page to a new location.  For example:
<div class="igBar"><span id="lphp-7"><a href="#" onclick="javascript:showPlainTxt('php-7'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-7">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/header"><span style="color:#000066;">header</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">"Location: http://www.search-this.com/"</span><span style="color:#006600; font-weight:bold;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></li>
<li>             <code>location()</code><br />
This is not a function in PHP, so it will fail with an error.</li>
<li>             <code>redirect()</code><br />
This is not a function in PHP, so it will fail with an error.</li>
</ol>
</li>
<li>
<h3>What function can you use to open a file for reading and writing?</h3>
<ol>
<li>             <code>fget()</code><br />
This is not a function in PHP, so it will fail with an error.</li>
<li>             <code>file_open()</code><br />
This is not a function in PHP, so it will fail with an error.</li>
<li>             <code>fopen()</code><br />
This is the correct function, it allows you to open a file for reading and/or writing. In fact, you have a lot of options, check out <a href="http://us.php.net/manual/en/function.fopen.php">php.net</a> for more information.</li>
<li>             <code>open_file()</code><br />
This is not a function in PHP, so it will fail with an error.</li>
</ol>
</li>
<li>
<h3>What's the difference between mysql_fetch_row() and mysql_fetch_array()?</h3>
<p><code>mysql_fetch_row()</code> returns all of the columns in an array using a 0 based index.  The first row would have the index of 0, the second would be 1, and so on.  Now another MySQL function in PHP is <code>mysql_fetch_assoc()</code>, which is an associative array.  Its' indexes are the column names.  For example, if my query was returning 'first_name', 'last_name', 'email', my indexes in the array would be 'first_name', 'last_name', and 'email'.  <code>mysql_fetch_array()</code> provides the output of <code>mysql_fetch_assoc</code> and <code>mysql_fetch_row()</code>.</li>
<li>
<h3>What does the following code do? Explain what's going on there.</h3>
<div class="igBar"><span id="lphp-8"><a href="#" onclick="javascript:showPlainTxt('php-8'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-8">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$date</span>=<span style="color:#FF0000;">'08/26/2003'</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/print"><span style="color:#000066;">print</span></a> <a href="http://www.php.net/ereg_replace"><span style="color:#000066;">ereg_replace</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">"([0-9]+)/([0-9]+)/([0-9]+)"</span>,<span style="color:#FF0000;">"<span style="color:#000099; font-weight:bold;">\\</span>2/<span style="color:#000099; font-weight:bold;">\\</span>1/<span style="color:#000099; font-weight:bold;">\\</span>3"</span>,<span style="color:#0000FF;">$date</span><span style="color:#006600; font-weight:bold;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>This code is reformatting the date from MM/DD/YYYY to DD/MM/YYYY.  A good friend got me hooked on writing regular expressions like below, so it could be commented much better, granted this is a bit excessive for such a simple regular expression.</p>
<div class="igBar"><span id="lphp-9"><a href="#" onclick="javascript:showPlainTxt('php-9'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-9">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">// Match 0-9 one or more times then a forward slash</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$regExpression</span> = <span style="color:#FF0000;">"([0-9]+)/"</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">// Match 0-9 one or more times then another forward slash</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$regExpression</span> .= <span style="color:#FF0000;">"([0-9]+)/"</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">// Match 0-9 one or more times yet again.</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$regExpression</span> .= <span style="color:#FF0000;">"([0-9]+)"</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Now the <code>\\2/\\1/\\3</code> denotes the parentheses matches.  The first parenthesis matches the month, the second the day, and the third the year.</li>
<li>
<h3>Given a line of text $string, how would you write a regular expression to strip all the HTML tags from it?</h3>
<p>First of all why would you write a regular expression when a PHP function already exists? See <a href="http://us.php.net/manual/en/function.strip-tags.php">php.net's strip_tags</a> function.  However, considering this is an interview question, I would write it like so:</p>
<div class="igBar"><span id="lphp-10"><a href="#" onclick="javascript:showPlainTxt('php-10'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-10">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$stringOfText</span> = <span style="color:#FF0000;">"&lt;p&gt;This is a test&lt;/p&gt;"</span>; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$expression</span> = <span style="color:#FF0000;">"/&lt;(.*?)&gt;(.*?)&lt;<span style="color:#000099; font-weight:bold;">\/</span>(.*?)&gt;/"</span>; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/echo"><span style="color:#000066;">echo</span></a> <a href="http://www.php.net/preg_replace"><span style="color:#000066;">preg_replace</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$expression</span>, <span style="color:#FF0000;">"<span style="color:#000099; font-weight:bold;">\\</span>2"</span>, <span style="color:#0000FF;">$stringOfText</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">// It was suggested (by Fred) that /(&lt;[^&gt;]*&gt;)/ would work too.</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$expression</span> = <span style="color:#FF0000;">"/(&lt;[^&gt;]*&gt;)/"</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/echo"><span style="color:#000066;">echo</span></a> <a href="http://www.php.net/preg_replace"><span style="color:#000066;">preg_replace</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$expression</span>, <span style="color:#FF0000;">""</span>, <span style="color:#0000FF;">$stringOfText</span><span style="color:#006600; font-weight:bold;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p>
</li>
<li>
<h3>What's the difference between the way PHP and Perl distinguish between arrays and hashes?</h3>
<p>This is why I tell everyone to, <em>"pick the language for the job!"</em>  If you only write code in a single language how will you ever answer this question?  The question is quite simple.  In Perl, you are required to use the @ sign to start all array variable names, for example, <code>@myArray</code>.  In PHP, you just continue to use the $ (dollar sign), for example, <code>$myArray</code>.</p>
<p>Now for hashes in Perl you must start the variable name with the % (percent sign), as in, <code>%myHash</code>.  Whereas, in PHP you still use the $ (dollar sign), as in, <code>$myHash</code>.</li>
<li>
<h3>How can you get round the stateless nature of HTTP using PHP?</h3>
<p>The top two options that are used are sessions and cookies.  To access a session, you will need to have <code>session_start()</code> at the top of each page, and then you will use the <code>$_SESSION</code> hash to access and store your session variables.  For cookies, you only have to remember one rule.  You must use the <code>set_cookie</code> function before any output is started in your PHP script.  From then on you can use the <code>$_COOKIE</code> has to access your cookie variables and values.</p>
<p>There are other methods, but they are not as fool proof and most often than not depend on the IP address of the visitor, which is a very dangerous thing to do.</li>
<li>
<h3>What does the GD library do?</h3>
<p>This is probably one of my favorite libraries, as it is built into PHP as of version 4.3.0 (I am very happy with myself, I didn't have to look up the version of PHP this was introduced on php.net).  This library allows you to manipulate and display images of various extensions.  More often than not, it is used to create thumbnail images.  An alternative to GD is <a href="http://www.imagemagick.org/">ImageMagick</a>, however, unlike GD, this does not come built in to PHP and must be installed on the server by an Administrator.</li>
<li>
<h3>Name a few ways to output (print) a block of HTML code in PHP?</h3>
<p>Well you can use any of the output statments in PHP, such as, <code>print</code>, <code>echo</code>, and <code>printf</code>.  Most individuals use the <code>echo</code> statement as in:</p>
<div class="igBar"><span id="lphp-11"><a href="#" onclick="javascript:showPlainTxt('php-11'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-11">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/echo"><span style="color:#000066;">echo</span></a> <span style="color:#FF0000;">"My string $variable"</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>However, you can also use it like so:</p>
<div class="igBar"><span id="lphp-12"><a href="#" onclick="javascript:showPlainTxt('php-12'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-12">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/echo"><span style="color:#000066;">echo</span></a> &lt;&lt;&lt;OUTPUT</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">This text is written to the screen <span style="color:#616100;">as</span> output and this <span style="color:#0000FF;">$variable</span> is parsed too.&nbsp; <span style="color:#616100;">If</span> you wanted you can have &amp;lt;span&amp;gt; HTML tags in here <span style="color:#616100;">as</span> well.&amp;lt;/span&amp;gt; The <a href="http://www.php.net/end"><span style="color:#000066;">END</span></a>; remarks must be on a line of its own, and can<span style="color:#FF0000;">'t contain any extra white space.</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF0000;">END; </span></div>
</li>
</ol>
</div>
</div>
</div>
<p></li>
<li>
<h3>Is PHP better than Perl? - Discuss.</h3>
<p>Come on, let's not start a flame over such a trivial question. As I have stated many times before,</p>
<blockquote><p>"Pick the language for the job, do not fit the job into a particular language."</p></blockquote>
<p>Perl in my opinion is great for command line utilities, yes it can be used for the web as well, but its' real power can be really demonstrated through the command line.  Likewise, PHP can be used on the command line too, but I personally feel it's more powerful on the web.  It has a lot more functions built with the web in mind, whereas, Perl seems to have the console in mind.</p>
<p>Personally, I love both languages.  I used Perl a lot in college and I used PHP and Java a lot in college.  Unfortunately, my job requires me to use C#, but I spend countless hours at home working in PHP, Perl, Ruby (currently learning), and Java to keep my skills up to date.  Many have asked me what happened to C and C++ and do they still fit into my applications from time to time.  The answer is primarily 'No'.  Lately all of my development work has been for the web and though C and C++ could be written for the web, they are hardly the language to use for such tasks.  <em>Pick the language for the job.</em>  If I needed a console application that was meant to show off the performance differences between a quick sort, bubble sort, and a merge sort, give me C/C++!  If you want a Photo Gallery, give me PHP or C# (though I personally find .NET languages better for quick GUI applications than web).</li>
</ol>
<p>I would like to take this time to challenge other companies to post their interview questions or feel free to email them to me at search-this [at] cpradio [dot] org.  I will be glad to read through them, and write an article about them revealing their answers for everyone to learn.</p>
<p><strong>Updated: 08/27/2007</strong><br />
Changed # to % for Perl Hashes - Thanks to MrSpooky for pointing that out, can't believe I forgot that!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.search-this.com/2007/08/27/yahoo-job-interview-questions-part-2/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
		<item>
		<title>Yahoo Job Interview Questions: Part 1</title>
		<link>http://www.search-this.com/2007/08/13/yahoo-job-interview-questions-part-1/</link>
		<comments>http://www.search-this.com/2007/08/13/yahoo-job-interview-questions-part-1/#comments</comments>
		<pubDate>Mon, 13 Aug 2007 13:09:53 +0000</pubDate>
		<dc:creator>cpradio</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Yahoo]]></category>

		<guid isPermaLink="false">http://www.search-this.com/2007/08/13/yahoo-job-interview-questions-part-1/</guid>
		<description><![CDATA[Have you ever wondered what it would be like to interview for a position at Google or Yahoo?
Well at another blog they shared some pre-interview questions from Yahoo for a PHP job. The only problem is they never provided the answers. So that's what I'm going to do now.
Yahoo, if you're watching, please check my [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Have you ever wondered what it would be like to interview for a position at Google or Yahoo?</strong></p>
<p>Well at another <a href="http://blog.assembleron.com/2007/05/23/php-interview-questions-from-yahoo/">blog</a> they shared some pre-interview questions from Yahoo for a PHP job. The only problem is they never provided the answers. So that's what I'm going to do now.</p>
<p>Yahoo, if you're watching, please check my answers and if they are right, I can start next week! <img src='http://www.search-this.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><strong>Questions 1 - 11</strong></p>
<ol>
<li>
<h3>Which of the following will NOT add john to the users array?</h3>
<ol>
<li>
            <code>$users[] = 'john';</code><br />
            Successfully adds john to the array
          </li>
<li>
            <code>array_add($users,’john’);</code><br />
            Fails stating Undefined Function array_add()
          </li>
<li>
            <code>array_push($users,‘john’);</code><br />
            Successfully adds john to the array
          </li>
<li>
            <code>$users ||= 'john';</code><br />
            Fails stating Syntax Error
          </li>
</ol>
</li>
<li>
<h3>What’s the difference between sort(), assort() and ksort? Under what circumstances would you use each of these?</h3>
<ol>
<li>
            <code>sort()</code><br />
            Sorts an array in alphabetical order based on the value of each element.  The index keys will also be renumbered 0 to length - 1.  This is used primarily on arrays where the indexes/keys do not matter.
          </li>
<li>
            <code>assort()</code><br />
            The assort function does not exist, so I am going to assume it should have been typed asort(). </p>
<p>            <code>asort()</code><br />
            Like the sort() function, this sorts the array in alphabetical order based on the value of each element, however, unlike the sort() function, all indexes are maintained, thus it will not renumber them, but rather keep them.  This is particularly useful with associate arrays.
          </li>
<li>
            <code>ksort()</code><br />
            Sorts an array in alphabetical order by index/key.  This is typically used for associate arrays where you want the keys/indexes to be in alphabetical order.
          </li>
</ol>
</li>
<li>
<h3>What would the following code print to the browser? Why?</h3>
<div class="igBar"><span id="lphp-19"><a href="#" onclick="javascript:showPlainTxt('php-19'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-19">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$num</span> = <span style="color:#CC66CC;color:#800000;">10</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">function</span> multiply<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#0000FF;">$num</span> = <span style="color:#0000FF;">$num</span> * <span style="color:#CC66CC;color:#800000;">10</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">multiply<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/echo"><span style="color:#000066;">echo</span></a> <span style="color:#0000FF;">$num</span>; <span style="color:#FF9933; font-style:italic;">// prints 10 to the screen </span></div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>        Since the function does not specify to use $num globally either by using global $num; or by $_GLOBALS['num'] instead of $num, the value remains 10.
      </li>
<li>
<h3>What is the difference between a reference and a regular variable? How do you pass by reference and why would you want to?</h3>
<p>        Reference variables pass the address location of the variable instead of the value.  So when the variable is changed in the function, it is also changed in the whole application, as now the address points to the new value.</p>
<p>        Now a regular variable passes by value, so when the value is changed in the function, it has no affect outside the function.</p>
<div class="igBar"><span id="lphp-20"><a href="#" onclick="javascript:showPlainTxt('php-20'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-20">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$myVariable</span> = <span style="color:#FF0000;">"its' value"</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">Myfunction<span style="color:#006600; font-weight:bold;">&#40;</span>&amp;<span style="color:#0000FF;">$myVariable</span><span style="color:#006600; font-weight:bold;">&#41;</span>; <span style="color:#FF9933; font-style:italic;">// Pass by Reference Example </span></div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>        So why would you want to pass by reference?  The simple reason, is you want the function to update the value of your variable so even after you are done with the function, the value has been updated accordingly.
      </li>
<li>
<h3>What functions can you use to add library code to the currently running script?</h3>
<p>        This is another question where the interpretation could completely hit or miss the question.  My first thought was class libraries written in PHP, so include(), include_once(), require(), and require_once() came to mind.  However, you can also include COM objects and .NET libraries.  By utilizing the <a href="http://us2.php.net/manual/en/function.com-load.php">com_load</a> and the <a href="http://us2.php.net/manual/en/function.dotnet-load.php">dotnet_load</a> respectively you can incorporate COM objects and .NET libraries into your PHP code, thus anytime you see "library code" in a question, make sure you remember these two functions.</p>
<li>
<h3>What is the difference between foo() &amp; @foo()?</h3>
<p>        foo() executes the function and any parse/syntax/thrown errors will be displayed on the page.</p>
<p>        @foo() will mask any parse/syntax/thrown errors as it executes.</p>
<p>        You will commonly find most applications use @mysql_connect() to hide mysql errors or @mysql_query. However, I feel that approach is significantly flawed as you should never hide errors, rather you should manage them accordingly and if you can, fix them.
      </li>
<li>
<h3>How do you debug a PHP application?</h3>
<p>        This isn't something I do often, as it is a pain in the butt to setup in Linux and I have tried numerous debuggers.  However, I will point out one that has been getting quite a bit of attention lately.</p>
<p>        PHP - Advanced PHP Debugger or PHP-APD.  First you have to install it by running:<br />
        <code>pear install apd</code></p>
<p>        Once installed, start the trace by placing the following code at the beginning of your script:<br />
        <code>apd_set_pprof_trace();</code></p>
<p>        Then once you have executed your script, look at the log in <em>apd.dumpdir</em>.<br />
        You can even use the pprofp command to format the data as in:<br />
        <code>pprofp -R /tmp/pprof.22141.0</code></p>
<p>        For more information see <a href="http://us.php.net/manual/en/ref.apd.php">http://us.php.net/manual/en/ref.apd.php</a>
      </li>
<li>
<h3>What does === do? What’s an example of something that will give true for ‘==’, but not ‘===’?</h3>
<p>        The === operator is used for functions that can return a Boolean false and that may also return a non-Boolean value which evaluates to false.  Such functions would be strpos and strrpos.</p>
<p>        I am having a hard time with the second portion, as I am able to come up with scenarios where '==' will be false and '===' would come out true, but it's hard to think of the opposite.  So here is the example I came up with:</p>
<div class="igBar"><span id="lphp-21"><a href="#" onclick="javascript:showPlainTxt('php-21'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-21">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#616100;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span><a href="http://www.php.net/strpos"><span style="color:#000066;">strpos</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">"abc"</span>, <span style="color:#FF0000;">"a"</span><span style="color:#006600; font-weight:bold;">&#41;</span> == <span style="color:#000000; font-weight:bold;">true</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#FF9933; font-style:italic;">// this does not get hit, since &quot;a&quot; is in the 0 index position, it returns false.</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#616100;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span><a href="http://www.php.net/strpos"><span style="color:#000066;">strpos</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">"abc"</span>, <span style="color:#FF0000;">"a"</span><span style="color:#006600; font-weight:bold;">&#41;</span> === <span style="color:#000000; font-weight:bold;">true</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#FF9933; font-style:italic;">// this does get hit as the === ensures this is treated as non-boolean.</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p>
      </li>
<li>
<h3>How would you declare a class named “myclass” with no methods or properties?</h3>
<div class="igBar"><span id="lphp-22"><a href="#" onclick="javascript:showPlainTxt('php-22'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-22">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">class</span> myclass</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p>
      </li>
<li>
<h3>How would you create an object, which is an instance of “myclass”?</h3>
<div class="igBar"><span id="lphp-23"><a href="#" onclick="javascript:showPlainTxt('php-23'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-23">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$obj</span> = <span style="color:#000000; font-weight:bold;">new</span> myclass<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p>
        It doesn't get any easier than this.
      </li>
<li>
<h3>How do you access and set properties of a class from within the class?</h3>
<p>        You use the $this-&gt;PropertyName syntax.</p>
<div class="igBar"><span id="lphp-24"><a href="#" onclick="javascript:showPlainTxt('php-24'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-24">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">class</span> myclass</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; private <span style="color:#0000FF;">$propertyName</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; public <span style="color:#000000; font-weight:bold;">function</span> __construct<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">propertyName</span> = <span style="color:#FF0000;">"value"</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p>
      </li>
</ol>
<p>There you have it!  The answers to questions 1 through 11.  Stay tuned for <a href="http://www.search-this.com/2007/08/27/yahoo-job-interview-questions-part-2/"><strong>Part 2 where I tackle 12 through 22</strong></a>.  If you have any questions, need further explanation, or just want to contribute to any of the above questions, comments are always welcome.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.search-this.com/2007/08/13/yahoo-job-interview-questions-part-1/feed/</wfw:commentRss>
		<slash:comments>21</slash:comments>
		</item>
		<item>
		<title>Top Searches of 2006</title>
		<link>http://www.search-this.com/2006/12/18/top-searches-of-2006/</link>
		<comments>http://www.search-this.com/2006/12/18/top-searches-of-2006/#comments</comments>
		<pubDate>Mon, 18 Dec 2006 21:27:41 +0000</pubDate>
		<dc:creator>Golgotha</dc:creator>
				<category><![CDATA[Google]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[Yahoo]]></category>

		<guid isPermaLink="false">http://www.search-this.com/2006/12/18/top-searches-of-2006/</guid>
		<description><![CDATA[Google - Top Searches in 2006

Bebo
Myspace
World cup
Metacafe
Radioblog
Wikipedia
Video
Rebelde
Mininova
Wiki

Yahoo - Top Searches in 2006

Britney Spears
WWE
Shakira
Jessica Simpson
Paris Hilton
American Idol
Beyonce Knowles
Chris Brown
Pamela Anderson
Lindsay Lohan

MSN - Top Searches in 2006

Ronaldinho
Shakira
Paris Hilton
Britney Spears
Harry Potter
Eminem
Pamela Anderson
Hilary Duff
Rebelde
Angelina Jolie


Anyone else find Google's top 10 searches for 2006 a little strange; or at least different as compared with Yahoo and MSN?


Yahoo and MSN both [...]]]></description>
			<content:encoded><![CDATA[<p>Google - Top Searches in 2006</p>
<ol>
<li>Bebo</li>
<li>Myspace</li>
<li>World cup</li>
<li>Metacafe</li>
<li>Radioblog</li>
<li>Wikipedia</li>
<li>Video</li>
<li>Rebelde</li>
<li>Mininova</li>
<li>Wiki</li>
</ol>
<p>Yahoo - Top Searches in 2006</p>
<ol>
<li>Britney Spears</li>
<li>WWE</li>
<li>Shakira</li>
<li>Jessica Simpson</li>
<li>Paris Hilton</li>
<li>American Idol</li>
<li>Beyonce Knowles</li>
<li>Chris Brown</li>
<li>Pamela Anderson</li>
<li>Lindsay Lohan</li>
</ol>
<p>MSN - Top Searches in 2006</p>
<ol>
<li>Ronaldinho</li>
<li>Shakira</li>
<li>Paris Hilton</li>
<li>Britney Spears</li>
<li>Harry Potter</li>
<li>Eminem</li>
<li>Pamela Anderson</li>
<li>Hilary Duff</li>
<li>Rebelde</li>
<li>Angelina Jolie</li>
</ol>
<p>
Anyone else find Google's top 10 searches for 2006 a little strange; or at least different as compared with Yahoo and MSN?
</p>
<p>
Yahoo and MSN both have Pamela Anderson, Britney Spears, and Paris Hilton in their top 10 searches. Google doesn't have any of these ladies?!
</p>
<p>
Can we say that Googles users are a little more highbrow than that of Yahoo and MSN?
</p>
<p>
And hats off to Pam Anderson. Did she do anything in 2006? Yet, still in the top 10!!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.search-this.com/2006/12/18/top-searches-of-2006/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Yahoo! Search Index Update</title>
		<link>http://www.search-this.com/2006/12/13/yahoo-search-index-update/</link>
		<comments>http://www.search-this.com/2006/12/13/yahoo-search-index-update/#comments</comments>
		<pubDate>Wed, 13 Dec 2006 16:15:42 +0000</pubDate>
		<dc:creator>Golgotha</dc:creator>
				<category><![CDATA[Yahoo]]></category>

		<guid isPermaLink="false">http://www.search-this.com/2006/12/13/yahoo-search-index-update/</guid>
		<description><![CDATA["We are in the process of rolling out some changes to our search results. As usual, you may be seeing some changes in ranking as well as some shuffling of the pages that are included in the index throughout this process. This update began on Sunday night and should be complete by tomorrow morning."

From Tim [...]]]></description>
			<content:encoded><![CDATA[<p>"We are in the process of rolling out some changes to our search results. As usual, you may be seeing some changes in ranking as well as some shuffling of the pages that are included in the index throughout this process. This update began on Sunday night and should be complete by tomorrow morning."</p>
<p>
From Tim Mayer Yahoo! Search</p>
]]></content:encoded>
			<wfw:commentRss>http://www.search-this.com/2006/12/13/yahoo-search-index-update/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
