<?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>Code Pixelz</title>
	<atom:link href="http://codepixelz.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://codepixelz.com</link>
	<description>Web design trends and News</description>
	<lastBuildDate>Thu, 09 Feb 2012 11:20:34 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
<meta xmlns="http://www.w3.org/1999/xhtml" name="robots" content="noindex,follow" />
		<item>
		<title>Walking array the PHP way, A look into array_walk()</title>
		<link>http://codepixelz.com/miscellaneous/walking-array-the-php-way-a-look-into-array_walk/</link>
		<comments>http://codepixelz.com/miscellaneous/walking-array-the-php-way-a-look-into-array_walk/#comments</comments>
		<pubDate>Thu, 09 Feb 2012 11:20:08 +0000</pubDate>
		<dc:creator>Utsav Singh Rathour</dc:creator>
				<category><![CDATA[Miscellaneous]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[array handling php]]></category>
		<category><![CDATA[array_walk()]]></category>
		<category><![CDATA[foreach array]]></category>
		<category><![CDATA[handling array in php]]></category>

		<guid isPermaLink="false">http://codepixelz.com/?p=456</guid>
		<description><![CDATA[If you’ve been developing with PHP for a while, you’ve probably come across this situation in the past: &#60;?php foreach ($somearray as &#38;$element) { $element = some_function($element); } It’s a common sight: taking an array and running (well, walking) its elements through a particular function. Luckily, PHP provides a simple yet powerful function to overcome [...]]]></description>
			<content:encoded><![CDATA[<p>If you’ve been developing with PHP for a while, you’ve probably come across this situation in the past:</p>
<blockquote><p>&lt;?php<br />
foreach ($somearray as &amp;$element) {<br />
$element = some_function($element);<br />
}</p></blockquote>
<p>It’s a common sight: taking an array and running (well, walking) its elements through a particular function. Luckily, PHP provides a simple yet powerful function to overcome this: <a href="http://developertutorials.com/php-manual/function.array-walk.html">array_walk()</a>.</p>
<p><span id="more-456"></span></p>
<p><strong>Usage</strong><br />
Using array walk is simple. It takes two arguments, an array of data and a callback function to pass the array to. It examines the array and calls the callback function with each element of the array, allowing you to run the entire array through the function without extracting the array yourself. Consider this:</p>
<blockquote><p>&lt;?php<br />
function some_function(&amp;$element, $key) {<br />
return $element + 1;<br />
}</p>
<p>// This:<br />
foreach ($somearray as $key=&gt;&amp;$element) $element = some_function($element, $key);</p>
<p>// becomes this:<br />
array_walk($somearray, &#8220;some_function&#8221;);</p></blockquote>
<p>It’s cleaner, faster and more effective. It also gives your callback function more information than you might usually provide. The callback parameter can be any : “function_name”, array(‘Class_name’, ‘method_name’) or even array($object, ‘method_name’) (where $object can be $this as needed).</p>
<p><strong>Syntax</strong><br />
The syntax is very simple:</p>
<pre>array_walk (array &amp;$array, callback $callback[, mixed $userdata]);</pre>
<p>The first parameter is the array that you want to run through the function. The second is the callback – for a function, class method or object method. The third allows you to pass a third parameter to the callback function from within the current context. This can be anything at all, and along with the array element and its key/index, will be passed directly to the function without modification.</p>
]]></content:encoded>
			<wfw:commentRss>http://codepixelz.com/miscellaneous/walking-array-the-php-way-a-look-into-array_walk/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to convert currencies using cURl and Google + PHP</title>
		<link>http://codepixelz.com/miscellaneous/how-to-convert-currencies-using-curl-and-google/</link>
		<comments>http://codepixelz.com/miscellaneous/how-to-convert-currencies-using-curl-and-google/#comments</comments>
		<pubDate>Tue, 07 Feb 2012 05:14:22 +0000</pubDate>
		<dc:creator>Utsav Singh Rathour</dc:creator>
				<category><![CDATA[Miscellaneous]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[add currency converter in website]]></category>
		<category><![CDATA[Currency covert using php]]></category>
		<category><![CDATA[currency exchange rate]]></category>
		<category><![CDATA[google currency converter in site]]></category>
		<category><![CDATA[how to convert currency with latest exchange rates]]></category>
		<category><![CDATA[use google to convert currency]]></category>

		<guid isPermaLink="false">http://codepixelz.com/?p=448</guid>
		<description><![CDATA[<img width="570" height="125" src="http://codepixelz.com/wp-content/uploads/2012/02/currency.jpg" class="attachment-storyimg wp-post-image" alt="currency" title="currency" />Converting currency would not have been a big deal if the exchange rate was fixed. But given that the exchange rate changes every other second, we use services from one of the trusted sites to show  the latest exchange rates. Here we take help of Google to find the latest currency exchange rate and convert [...]]]></description>
			<content:encoded><![CDATA[<img width="570" height="125" src="http://codepixelz.com/wp-content/uploads/2012/02/currency.jpg" class="attachment-storyimg wp-post-image" alt="currency" title="currency" /><p>Converting currency would not have been a big deal if the exchange rate was fixed. But given that the exchange rate changes every other second, we use services from one of the trusted sites to show  the latest exchange rates. Here we take help of Google to find the latest currency exchange rate and convert the currency to required currency. I hope this piece of code helps you.</p>
<p><span id="more-448"></span></p>
<blockquote><p>function convert_currency($from,$to,$amount) {<br />
$amount = urlencode($amount);<br />
$from = urlencode($from);<br />
$to = urlencode($to);<br />
$url = &#8220;http://www.google.com/ig/calculator?hl=en&amp;q=$amount$from=?$to&#8221;;<br />
$ch = curl_init();<br />
$timeout = 0;<br />
curl_setopt ($ch, CURLOPT_URL, $url);<br />
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);<br />
curl_setopt($ch, CURLOPT_USERAGENT , &#8220;Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1)&#8221;);<br />
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);<br />
$rawdata = curl_exec($ch);<br />
curl_close($ch);<br />
$data = explode(&#8216;&#8221;&#8216;, $rawdata);<br />
$data = explode(&#8216; &#8216;, $data['3']);<br />
$var = $data['0'];<br />
return round($var,2);<br />
}</p></blockquote>
<p>All you have to do now is call the function on your file and at required place and pass the To and From Currency and the amount to be converted.  Like you would call a regular function.</p>
<blockquote><p>&lt;?php convert_currency(&#8220;USD&#8221;,&#8221;GBP&#8221;,&#8221;500&#8243;); ?&gt;</p></blockquote>
<p>That is it. a no nonsense snippet of code to get the job done.</p>
]]></content:encoded>
			<wfw:commentRss>http://codepixelz.com/miscellaneous/how-to-convert-currencies-using-curl-and-google/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Top 10 Free Time Tracking Apps for Freelancers</title>
		<link>http://codepixelz.com/miscellaneous/top-10-free-time-tracking-apps-for-freelancers/</link>
		<comments>http://codepixelz.com/miscellaneous/top-10-free-time-tracking-apps-for-freelancers/#comments</comments>
		<pubDate>Thu, 02 Feb 2012 15:50:21 +0000</pubDate>
		<dc:creator>Utsav Singh Rathour</dc:creator>
				<category><![CDATA[Freelancer]]></category>
		<category><![CDATA[Miscellaneous]]></category>
		<category><![CDATA[free time tracking app]]></category>
		<category><![CDATA[freelancer]]></category>
		<category><![CDATA[Freelancing]]></category>
		<category><![CDATA[online time tracking app]]></category>
		<category><![CDATA[time management]]></category>
		<category><![CDATA[time tracking]]></category>

		<guid isPermaLink="false">http://codepixelz.com/?p=443</guid>
		<description><![CDATA[<img width="550" height="350" src="http://codepixelz.com/wp-content/uploads/2012/02/creattica_calendar.jpg" class="attachment-storyimg wp-post-image" alt="Time tracker for freelancer" title="creattica_calendar" />Usually two words “freelancer” and “time” go together. Freelancers can’t juggle multiple tasks simultaneously and that’s why we need to allocate time carefully. Time is an essential source of freelancer financial success. There are lots of web apps that help track time and create reports. If you use one of the tools on a daily basis, you [...]]]></description>
			<content:encoded><![CDATA[<img width="550" height="350" src="http://codepixelz.com/wp-content/uploads/2012/02/creattica_calendar.jpg" class="attachment-storyimg wp-post-image" alt="Time tracker for freelancer" title="creattica_calendar" /><p>Usually two words “freelancer” and “time” go together. Freelancers can’t juggle multiple tasks simultaneously and that’s why we need to allocate time carefully. Time is an essential source of freelancer financial success.</p>
<p>There are lots of <a title="web apps that help track time" href="http://freelanceswitch.com/productivity/6-cool-tools-to-track-your-time/">web apps that help track time</a> and create reports. If you use one of the tools on a daily basis, you can turn your work into a structured schedule, get more spare time for fun, and improve your productivity. Here’s is an overview of 10 top free apps for time management for freelancers.<span id="more-443"></span></p>
<h4><a title="Google Calendar" href="http://www.google.com/calendar">GOOGLE CALENDAR</a></h4>
<div id="attachment_24177"><a title="Google Calendar" href="http://www.google.com/calendar"><img src="http://freelanceswitch.com/wp-content/uploads/2012/01/Google-Calendar.png" alt="Google Calendar" width="550" height="350" /></a>GOOGLE CALENDAR</div>
<p>Google Calendar is a free universal tool to track your time, appointments and organize your freelance tasks. Google app may serve as a calendar or a to-do list. Besides, it’s easy to export Google calendar data to lots of project management solutions and thus, you can always keep an eye on your schedule.</p>
<h4><a title="OfficeTime" href="http://www.officetime.net/">OFFICETIME</a></h4>
<div id="attachment_24191"><a title="OfficeTime" href="http://www.officetime.net/"><img src="http://freelanceswitch.com/wp-content/uploads/2012/01/OfficeTime.png" alt="OfficeTime" width="550" height="350" /></a>OFFICETIME</div>
<p>OfficeTime is an elegant cross platform time tracking application. You can track your activity on your computer and iPad. OfficeTime contains advanced time management features: dashboard, spreadsheets data import and stat reports. Besides, the app has built-in invoicing options. So it enables you to start your freelance project, assign a rate per hour and generate the final invoice.</p>
<h4><a title="TimePanther" href="http://www.timepanther.com/">TIMEPANTHER</a></h4>
<div id="attachment_24178"><a title="TimePanther" href="http://www.timepanther.com/"><img src="http://freelanceswitch.com/wp-content/uploads/2012/01/TimePanther.png" alt="TimePanther" width="550" height="350" /></a>TIMEPANTHER</div>
<p>TimePanther claims to be a time tracker for freelancers. The app includes time management options that help set tasks, divide them between your projects and calculate your revenue. TimePanther allows you to sync all freelance tasks without any mess within clients.</p>
<h4><a title="Cube" href="http://www.cubeanywhere.com/">CUBE</a></h4>
<div id="attachment_24180"><a title="Cube" href="http://www.cubeanywhere.com/"><img src="http://freelanceswitch.com/wp-content/uploads/2012/01/Cube.png" alt="Cube" width="550" height="350" /></a>CUBE</div>
<p>Cube Anywhere is a nice time tracker for any device. Freelancers are famous for mobility; that’s why our time tracker must be a cross-platform product. Add your tasks, create a schedule and manage your earnings per hour. Cube has an easy sign-up from. You can quickly create an account with your Google ID.</p>
<h4><a title="Clockodo" href="http://www.clockodo.com/en">CLOCKODO</a></h4>
<div id="attachment_24181"><a title="Clockodo" href="http://www.clockodo.com/en"><img src="http://freelanceswitch.com/wp-content/uploads/2012/01/Clockodo.png" alt="Clockodo" width="550" height="350" /></a>CLOCKODO</div>
<p>Clockodo is an easy time tracking suite. It lets you manage tasks, track time and view reports. The stylish web app represents all information in a simple to comprehend way and turns time management into a real pleasure.</p>
<h4><a title="Klok" href="http://www.getklok.com/">KLOK</a></h4>
<div id="attachment_24182"><a title="Klok" href="http://www.getklok.com/"><img src="http://freelanceswitch.com/wp-content/uploads/2012/01/Klok.png" alt="Klok" width="550" height="350" /></a>KLOK</div>
<p>Klok is a cross platform time management program that work on Windows, Linux, Mac and Android OS. You can analyze your time consumption and share your calendar with freelance colleagues. Moreover, you can transfer data smoothly between Basecamp, Harvest or Fresh Books.</p>
<h4><a title="Paymo" href="http://www.paymo.biz/">PAYMO</a></h4>
<div id="attachment_24183"><a title="Paymo" href="http://www.paymo.biz/"><img src="http://freelanceswitch.com/wp-content/uploads/2012/01/Paymo.png" alt="Paymo" width="550" height="350" /></a>PAYMO</div>
<p>Paymo is a freelancer business center. The app has lots of handy features inside: time tracking, billing and invoicing, project management tools. It’s up to you to select the options you need. For example, you can count hours and create reports for your clients.</p>
<h4><a title="Chrometa" href="http://www.chrometa.com/">CHROMETA</a></h4>
<div id="attachment_24184"><a title="Chrometa" href="http://www.chrometa.com/"><img src="http://freelanceswitch.com/wp-content/uploads/2012/01/Chrometa.png" alt="Chrometa" width="550" height="350" /></a>CHROMETA</div>
<p>Chrometa has an exceptional approach to time tracking. It automates time tracking. Install a tiny app on your computer and it will record your software usage. Examine your daily reports and see how much time you spend on web surfing, Skype, Photoshop or coding. Thus, Chrometa lets you revalue your time and boost your freelancing productivity.</p>
<h4><a title="30 Boxes" href="http://30boxes.com/">30 BOXES</a></h4>
<div id="attachment_24185"><a title="30 Boxes" href="http://30boxes.com/"><img src="http://freelanceswitch.com/wp-content/uploads/2012/01/30-Boxes.png" alt="30 Boxes" width="550" height="350" /></a>30 BOXES</div>
<p>30Boxes is a web calendar. Fill it with important tasks and alerts. Plus, place your personal reminders and track all key events in one place. This way 30 Boxes lets you balance your freelancing life efficiently.</p>
<h4>YOUR TIMER</h4>
<div id="attachment_24434"><img src="http://freelanceswitch.com/wp-content/uploads/2012/01/Your-Timer.jpg" alt="Your Timer" width="550" height="350" />YOUR TIMER</div>
<p>As you see the list contains only 9 apps for freelancers to track time. The last but not the least can be a default timer app, your favorite spreadsheet program, or your watch. Let us know which time tracker you prefer that deserves to be on this list!</p>
<p>&nbsp;</p>
<p>Source: <a href="http://freelanceswitch.com/productivity/free-time-tracking-apps/">http://freelanceswitch.com/productivity/free-time-tracking-apps/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://codepixelz.com/miscellaneous/top-10-free-time-tracking-apps-for-freelancers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How To Display a Message on Old WordPress Posts</title>
		<link>http://codepixelz.com/css/how-to-display-a-message-on-old-wordpress-posts/</link>
		<comments>http://codepixelz.com/css/how-to-display-a-message-on-old-wordpress-posts/#comments</comments>
		<pubDate>Tue, 31 Jan 2012 10:20:25 +0000</pubDate>
		<dc:creator>Utsav Singh Rathour</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[articles age]]></category>
		<category><![CDATA[display message on old articles]]></category>
		<category><![CDATA[warn old post]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://codepixelz.com/?p=436</guid>
		<description><![CDATA[<img width="600" height="187" src="http://codepixelz.com/wp-content/uploads/2012/01/message1.jpg" class="attachment-storyimg wp-post-image" alt="message" title="message" />If you post helpful information on your blog chances are some of your early posts are now outdated as technologies have changed over the years. Let’s take a look at how we can add a mix of PHP tags to our WordPress themes to automatically add a small disclaimer or warning message to posts over [...]]]></description>
			<content:encoded><![CDATA[<img width="600" height="187" src="http://codepixelz.com/wp-content/uploads/2012/01/message1.jpg" class="attachment-storyimg wp-post-image" alt="message" title="message" /><p>If you post helpful information on your blog chances are some of your early posts are now outdated as technologies have changed over the years. Let’s take a look at how we can add a mix of PHP tags to our WordPress themes to automatically add a small disclaimer or warning message to posts over X years old.</p>
<p>The little snippets of code we’re going to add to our theme will allow us to display a message above our post content, but only on posts over a number of years old. We might only want to display this message on certain types of posts, in my case it’s only my tutorials that have become outdated, so we’ll also add a category filter to target only old posts from a particular section of the blog.<span id="more-436"></span></p>
<p>&nbsp;</p>
<pre>&lt;?php
$post_age = date('Y') - get_the_time('Y');
if($post_age &gt; 2 &amp;&amp; in_category('4') ) { ?&gt;

&lt;div&gt;
&lt;p&gt;&lt;strong&gt;This post was originally published in &lt;?php the_time('Y'); ?&gt;&lt;/strong&gt;&lt;br /&gt;
The tips and techniques explained may be outdated.&lt;/p&gt;
&lt;/div&gt;

&lt;?php } ?&gt;</pre>
<p>I had to do a little Google researching to actually figure this out. I stumbled over <a href="http://forrst.com/posts/Display_a_message_on_older_post_Wordpress-B0M">Horacio Bella’s Forrst post</a> that provides the basic syntax, I then did a little modification to suit my own requirements.<br />
The first line of code takes today’s year and minuses the year the post was published, which gives the post’s age in the <code>$post_age</code> variable. The script then checks if the post age is over 2 years old <em>and</em> is in category ID 4. You could change this filter using many of the <a href="http://codex.wordpress.org/Conditional_Tags">WordPress Conditional Tags</a>.<br />
A line of simple HTML fleshes out a message to the user, explaining that the post is a few years old and therefore the content may be outdated. We can use the WordPress <code>&lt;?php the_time('Y'); ?&gt;</code> tag to automatically enter the year the post was published.<br />
Paste this code into your single.php template file above the <code>&lt;?php the_content(); ?&gt;</code> tag.</p>
<h3>The CSS styling</h3>
<p>Once the code is in place in the template file and the unformatted message is appearing on the correct posts, it can then be styled up with CSS.</p>
<pre>.old-post {
	margin: 0 0 20px 0; padding: 15px 20px;
	background: #e9e9eb url(images/grey-bg.png);
}
	.old-post p {
		background: url(images/warning.png) left no-repeat; padding: 0 0 0 65px;
		color: #717171;
	}</pre>
<p>The old-post div is styled up with a textured grey background and plenty of padding around the edges. A warning icon is then added as a CSS background image on the paragraph element and the text indented with some left padding.</p>
<p>&nbsp;</p>
<p>Source: <a href="http://line25.com/tutorials/how-to-display-a-message-on-old-wordpress-posts">http://line25.com/tutorials/how-to-display-a-message-on-old-wordpress-posts</a></p>
]]></content:encoded>
			<wfw:commentRss>http://codepixelz.com/css/how-to-display-a-message-on-old-wordpress-posts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP Arrays: Array Functions and Multidimensional Arrays</title>
		<link>http://codepixelz.com/miscellaneous/php-arrays-array-functions-and-multidimensional-arrays/</link>
		<comments>http://codepixelz.com/miscellaneous/php-arrays-array-functions-and-multidimensional-arrays/#comments</comments>
		<pubDate>Thu, 26 Jan 2012 15:44:40 +0000</pubDate>
		<dc:creator>Utsav Singh Rathour</dc:creator>
				<category><![CDATA[Miscellaneous]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[Array]]></category>
		<category><![CDATA[Functions and Multidimensional Arrays]]></category>
		<category><![CDATA[PHP Arrays]]></category>

		<guid isPermaLink="false">http://codepixelz.com/?p=432</guid>
		<description><![CDATA[The difference between one-dimensional and multidimensional arrays is a simple one: a multidimensional array is a simple array that has simple arrays as elements, rather than strings or scalar variables. Building a Multidimensional Array Here is how our $arrBooks example from last week’s article can be expanded into a multidimensional array: &#60;?php $arrBooks = array( [...]]]></description>
			<content:encoded><![CDATA[<p>The difference between one-dimensional and multidimensional arrays is a simple one: a multidimensional array is a simple array that has simple arrays as elements, rather than strings or scalar variables.</p>
<h2>Building a Multidimensional Array</h2>
<p>Here is how our <em>$arrBooks </em>example from last week’s article can be expanded into a multidimensional array:<span id="more-432"></span></p>
<pre class="brush: js">&lt;?php
$arrBooks = array(
‘Comic’ =&gt; array(
‘Title’=&gt;‘Superman’,
‘Author’=&gt;’Jerry Siegel and Joe Shuster’,
‘Publication Date’ =&gt; ‘1938’),

‘Science Fiction’ =&gt; array(
‘Title’=&gt;‘Dune’,
‘Author’=&gt;’Frank Herbert’,
‘Publication Date’=&gt;’1965’),

‘Fantasy’ =&gt; array(
‘Title’=&gt;‘The Hobbit’,
‘Author’=&gt;’J.R.R. Tolkien’,
‘Publication Date’=&gt;’1937’),   

‘Horror’ =&gt; array(
‘Title’=&gt;‘Carrie’,
‘Author’=&gt;’Stephen King’,
‘Publication Date’=&gt;’1974’)
);
?&gt;</pre>
<h2>Extracting Elements from a Multidimensional Array</h2>
<p>To extract a single element from the multidimensional array, you must refer to the keys in both the outer and inner arrays. For instance, the PHP code below:</p>
<pre class="brush: js">&lt;?
echo $arrBooks[‘Science Fiction][‘Title’];
echo "&lt;br&gt;";
echo $arrBooks[‘Horror’][‘Author’];
?&gt;</pre>
<p>would display:</p>
<pre class="brush: js">Dune
Stephen King</pre>
<h2>Looping Through a Multidimensional Array</h2>
<p>The easiest way to loop through a multidimensional array is to nest two <em>foreach </em>loops; the outer loop goes through each outer array element, and the inner loop goes through each inner array element within the selected outer element.</p>
<pre class="brush: js">&lt;?
foreach ($arrBooks as $obj_key =&gt;$book)
{
echo "$obj_key Book:&lt;br&gt;";
foreach ($book as $key=&gt;$value){
echo "$key: $value&lt;br&gt;";
}
echo "&lt;br&gt;";
}
?&gt;</pre>
<p>The display will look like this:</p>
<pre class="brush: js">Comic Book:
Title: Superman
Author: Jerry Siegel and Joe Shuster
Publication Date: 1938

Science Fiction Book:
Title: Dune
Author: Frank Herbert
Publication Date: 1965

Fantasy Book:
Title: The Hobbit
Author: J.R.R. Tolkien
Publication Date: 1937

Horror Book:
Title: Carrie
Author: Stephen King
Publication Date: 1974</pre>
<h2>Array Functions</h2>
<p>Arrays are one of the most useful variable types. Along with its versatility, arrays also can use a variety of functions. In the previous lesson, we used the <em>is_array</em> function to determine if a variable was an array and the <em>sort </em>function to sort the elements of an array. Here are some more examples of array functions.</p>
<p><em>count($array)</em>: Counts the number of elements in an array.</p>
<pre class="brush: js">&lt;?
$numBooks = count($arrBooks);
echo "There are $numBooks books in the collection.&lt;br&gt;";
?&gt;

There are 4 books in the collection.</pre>
<p><em>extract($array)</em>: Converts associative array keys into string variables. The values of each key become the values of each variable.</p>
<pre class="brush: js">&lt;?
$arrBooks = array(    ‘Comic’ =&gt; ‘Superman’,
‘ScienceFiction’ =&gt; ‘Dune’,
‘Fantasy’ =&gt; ‘The Hobbit’,
‘Horror’ =&gt; ‘Carrie’);

extract($arrBooks);
// $arrBooks[‘Comic’] becomes $Comic
// $arrBooks[‘ScienceFiction’] becomes $ScienceFiction
// $arrBooks[‘Fantasy] becomes $Fantasy
// $arrBooks[‘Horror] becomes $Horror

echo "$Comic is a comic book.&lt;br&gt;";
echo "$Fantasy is a fantasy book.&lt;br&gt;";

?&gt;

Superman is a comic book.
The Hobbit is a fantasy book.</pre>
<p><em>extract($array, EXTR_PREFIX_ALL, ‘prefix’)</em>: Adds a prefix to the string variable to differentiate between arrays that have the same keys.</p>
<pre class="brush: js">&lt;?
$arrBooks = array(
‘Comic’ =&gt; ‘Superman’,
‘ScienceFiction’ =&gt; ‘Dune’,
‘Fantasy’ =&gt; ‘The Hobbit’,
‘Horror’ =&gt; ‘Carrie’);

extract($arrBooks, EXTR_PREFIX_ALL, "books");
// $arrBooks[‘Comic’] becomes $books_Comic
// $arrBooks[‘ScienceFiction’] becomes $books_ScienceFiction
// $arrBooks[‘Fantasy] becomes $books_Fantasy
// $arrBooks[‘Horror] becomes $books_Horror

echo "$books_Comic is a comic book.&lt;br&gt;";
echo "$books_Fantasy is a fantasy book.&lt;br&gt;";

$arrFilms = array(
‘Comic’ =&gt; ‘Superman Returns’,
‘ScienceFiction’ =&gt; ‘Terminator’,
‘Fantasy’ =&gt; ‘Dark Crystal’,
‘Horror’ =&gt; ‘Friday the 13th’);

extract($arrFilms, EXTR_PREFIX_ALL, "films");
// $arrFilms [‘Comic’] becomes $films_Comic
// $arrFilms [‘ScienceFiction’] becomes $films_ScienceFiction
// $arrFilms [‘Fantasy] becomes $films_Fantasy
// $arrFilms [‘Horror] becomes $films _Horror

echo "$films_Comic is a comic film.&lt;br&gt;";
echo "$films_Fantasy is a fantasy film.&lt;br&gt;";
?&gt;

Superman is a comic book.
The Hobbit is a fantasy book.
Superman Returns is a comic film.
Dark Crystal is a fantasy film.</pre>
<p><em>compact(var1, var2, var3)</em>: Converts a list of variables into an array.</p>
<pre class="brush: js">&lt;?
$Comic = ‘Batman’;
$ScienceFiction = ‘Dreaming Void’;
$Fantasy = ‘American Gods’;
$Horror = ‘Frankenstein’;

$arrBooks2 = compact (‘Comic’, ‘ScienceFiction’, ‘Fantasy’, ‘Horror’);

foreach ($arrBooks2 as $key =&gt; $value) {
print  "$value is an example of a $key book.&lt;br&gt;\n";
}
?&gt;

Batman is an example of a Comic book.
Dreaming Void is an example of a ScienceFiction book.
American Gods is an example of a Fantasy book.
Frankenstein is an example of a Horror book.</pre>
<pre class="brush: js"></pre>
<p>Source: <a href="http://www.developerdrive.com/2012/01/php-arrays-array-functions-and-multidimensional-arrays/">http://www.developerdrive.com/2012/01/php-arrays-array-functions-and-multidimensional-arrays/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://codepixelz.com/miscellaneous/php-arrays-array-functions-and-multidimensional-arrays/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>What is SOPA, PIPA? And why is it being protested?</title>
		<link>http://codepixelz.com/miscellaneous/what-is-sopa/</link>
		<comments>http://codepixelz.com/miscellaneous/what-is-sopa/#comments</comments>
		<pubDate>Fri, 20 Jan 2012 04:15:51 +0000</pubDate>
		<dc:creator>Utsav Singh Rathour</dc:creator>
				<category><![CDATA[Miscellaneous]]></category>
		<category><![CDATA[PIPA]]></category>
		<category><![CDATA[SOPA]]></category>
		<category><![CDATA[SOPA protest]]></category>
		<category><![CDATA[stop pipa]]></category>
		<category><![CDATA[stop sopa]]></category>
		<category><![CDATA[What is SOPA]]></category>
		<category><![CDATA[Why is SOPA bad?]]></category>

		<guid isPermaLink="false">http://codepixelz.com/?p=425</guid>
		<description><![CDATA[<img width="537" height="326" src="http://codepixelz.com/wp-content/uploads/2012/01/SOPA-Blackout-Success-1-537x326.jpg" class="attachment-storyimg wp-post-image" alt="SOPA-Blackout-Success-1-537x326" title="SOPA-Blackout-Success-1-537x326" />Supporters of the Stop Online Piracy Act, or SOPA (and its Senate-sister the Protect Intellectual Property Act, PIPA) legislation — like the Motion Picture Association of America (MPAA) — argue that legislation is needed because online piracy puts jobs and industries at risk. While I agree that content piracy is a real problem, the language and implications of SOPA has [...]]]></description>
			<content:encoded><![CDATA[<img width="537" height="326" src="http://codepixelz.com/wp-content/uploads/2012/01/SOPA-Blackout-Success-1-537x326.jpg" class="attachment-storyimg wp-post-image" alt="SOPA-Blackout-Success-1-537x326" title="SOPA-Blackout-Success-1-537x326" /><p>Supporters of the Stop Online Piracy Act, or <a href="http://mashable.com/follow/topics/sopa">SOPA</a> (and its Senate-sister the Protect Intellectual Property Act, <a href="http://mashable.com/follow/topics/pipa">PIPA</a>) legislation — like the Motion Picture Association of America (<a href="http://mashable.com/2012/01/17/mpaa-sopa-pipa/">MPAA</a>) — argue that legislation is needed because online piracy puts jobs and industries at risk.</p>
<p>While I agree that content piracy is a real problem, <a href="http://mashable.com/2012/01/17/sopa-dangerous-opinion/">the language and implications of SOPA</a> has the potential to hurt the very industries and content creators the bills purport to protect.</p>
<p><span id="more-425"></span></p>
<p>Artists and content creators are understandably bothered by how easy it is to obtain content without payment. My musician friends cringe when their albums are available for download even before the CD is pressed. My filmmaker friends distress over seeing the blood, sweat and tears put into a project more easily accessible from MegaVideo or other filesharing sites than from Amazon or Netflix. It’s only natural to want to put a stop to these types of infringing sites and situations.</p>
<p>The backers of SOPA and PIPA believe that forcing ISPs, search engines, web hosts and users to take responsibility for infringing behavior will put a stop to the infringement. This is short-sighted and misguided.</p>
<p>Let’s be clear — there is a large underground business that profits off of copyright infringement and digital piracy. For the most part, however, that business is not online. In parts of Asia, such as China, Hong Kong and Taiwan, it’s a chore to find content for sale that is <em>not</em> pirated. Perfect digital copies of movies, television shows, music and software are for sale in packaging that looks and feels as if it were authentic.</p>
<p>First-run movies hit the streets in China before the films play at the Cineplex. This is not a new phenomenon; it’s been happening for decades.</p>
<p>That industry will not disappear because of SOPA. The groups that source and distribute content will not be affected because they are technically savvy enough to get around restrictions. Finding a web host in another country and using a VPN service to tunnel to a different server is a trivial task.</p>
<p>Moreover, the countries where the bulk of the actual profit from piracy takes place will have little incentive to enforce a U.S. law. Just look at the situation involving the now-defunct <a href="http://en.wikipedia.org/wiki/AllOfMP3" target="_blank">AllofMP3.com</a> — a site that sold DRM-free music to users in the U.S. and other parts of the world for $0.10 a track under a Russian copyright loophole.</p>
<p>The site was eventually shut down, thanks to pressure from the Bush administration and payment companies. But Russian courts ruled the site was not guilty of infringement in that country.</p>
<p>SOPA and PIPA have the potential to stop less tech-savvy individuals from downloading the latest episode of<em>30 Rock</em>. For the most avid infringers, however, years of USENET, “warez” forums and private invite-only BitTorrent communities have already taught them how to get around those ISP-infringement letters.</p>
<hr />
<h2>Spend Money on Solutions, Not Legislation</h2>
<hr />
<p>The issue of piracy and copyright infringement needs to be addressed. But this legislation does not do anything to adequately solve the problem.</p>
<p>I have never hidden the fact that I have downloaded content without paying for it. Call me a pirate, call me a freeloader, call me a thief. The truth is, I’ve downloaded hundreds of music albums, television shows and pieces of software since 1998.</p>
<p>To be totally fair, I’ve also spent at least $25,000 on DVD and Blu-ray discs alone, easily another $10,000 on music and books, and at least that much on software.</p>
<p>Most people pirate or purchase pirated content because legal access is unavailable or too difficult to decipher. For years, I frequently purchased an album on iTunes and then downloaded a higher quality version from a BitTorrent tracker to get the best fidelity, as well as portability. Likewise, I frequently downloaded episodes of TV shows immediately after airing but then later bought the show on DVD to get the extra features.</p>
<p>The reason that services like iTunes, Spotify, Hulu and Steam have found success is because they make it easy for users to pay for content they want to access. Instead of investing in legislation that attempts to turn back the digital clock, these lobbying groups should be focusing on initiatives that modernize the way content is delivered.</p>
<p>Stop looking at infringers as pirates or criminals and instead look at them as potential customers. Find a way to make content worth obtaining legally so that artists, distributors and producers can all get paid.</p>
<p>SOPA and PIPA do neither of these tasks. Instead, they focus on an untenable goal of stopping piracy. The real pirates and infringers will be untouched by U.S. legislation. But online freedom will be at risk.</p>
<p>&nbsp;</p>
<p>Source: <a href="http://mashable.com">Mashable.com</a></p>
]]></content:encoded>
			<wfw:commentRss>http://codepixelz.com/miscellaneous/what-is-sopa/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

