<?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>PHP Archives - SideCode</title>
	<atom:link href="https://sidecode.io/dev-blog-category/php/feed/" rel="self" type="application/rss+xml" />
	<link>https://sidecode.io/dev-blog-category/php/</link>
	<description>Web Development &#38; IT Consulting Company</description>
	<lastBuildDate>Thu, 14 May 2020 09:17:30 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.1.1</generator>

<image>
	<url>https://sidecode.io/wp-content/uploads/logo_icon-150x150.png</url>
	<title>PHP Archives - SideCode</title>
	<link>https://sidecode.io/dev-blog-category/php/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Installing Composer Globally on CentOS 7</title>
		<link>https://sidecode.io/dev-blog/installing-composer-globally-on-centos-7/</link>
		
		<dc:creator><![CDATA[jhonny]]></dc:creator>
		<pubDate>Sun, 03 Sep 2017 10:16:55 +0000</pubDate>
				<guid isPermaLink="false">https://sidecode.io/?post_type=blog&#038;p=1162</guid>

					<description><![CDATA[<p># Installing Composer Globally on CentOS 7 First you need to make sure your system is up-do-date, for that you need to run yum -y update Download and install Composer by executing the following command: curl -sS https://getcomposer.org/installer &#124; php Once the process completes, you can make the ‘composer.phar’ file executable by running the ...</p>
<p>The post <a rel="nofollow" href="https://sidecode.io/dev-blog/installing-composer-globally-on-centos-7/">Installing Composer Globally on CentOS 7</a> appeared first on <a rel="nofollow" href="https://sidecode.io">SideCode</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h3><a href="“#”"># </a>Installing Composer Globally on CentOS 7</h3>
<p>First you need to make sure your system is up-do-date, for that you need to run</p>
<pre>yum -y update
</pre>
<p>Download and install Composer by executing the following command:</p>
<pre>curl -sS https://getcomposer.org/installer | php
</pre>
<p>Once the process completes, you can make the ‘composer.phar’ file executable by running the following command:</p>
<pre>chmod +x composer.phar
</pre>
<p>Now use the following commands to make composer available globally for all users in your system, which can be used for all php applications on that system:</p>
<pre>mv composer.phar /usr/local/bin/composer
</pre>
<p>You can also check the version of composer by running bellow command:</p>
<pre>composer -V
</pre>
<p>And you are ready to go.</p>
<p>The post <a rel="nofollow" href="https://sidecode.io/dev-blog/installing-composer-globally-on-centos-7/">Installing Composer Globally on CentOS 7</a> appeared first on <a rel="nofollow" href="https://sidecode.io">SideCode</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Fast WordPress Debugging (Debug to console)</title>
		<link>https://sidecode.io/dev-blog/fast-wordpress-debugging-debug-to-console/</link>
		
		<dc:creator><![CDATA[jhonny]]></dc:creator>
		<pubDate>Wed, 02 Nov 2016 10:18:57 +0000</pubDate>
				<guid isPermaLink="false">https://sidecode.io/?post_type=blog&#038;p=1167</guid>

					<description><![CDATA[<p>A fast way to debug that I use to debug in WordPress, In fact I got used to it so much that I use it on any PHP environment or framework that i work on. The method is debugging php variables and arrays to the console (the browser console) and will print out at ...</p>
<p>The post <a rel="nofollow" href="https://sidecode.io/dev-blog/fast-wordpress-debugging-debug-to-console/">Fast WordPress Debugging (Debug to console)</a> appeared first on <a rel="nofollow" href="https://sidecode.io">SideCode</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>A fast way to debug that I use to debug in WordPress, In fact I got used to it so much that I use it on any PHP environment or framework that i work on. The method is debugging php variables and arrays to the console (the browser console) and will print out at runtime as the code is being executed in the browser the variable value.</p>
<p>Just a small method that in WordPress I just add it (always) to the <code>functions.php</code> file, and in other php frameworks, add it as a general global helper function.</p>
<h3><a href="#">#</a> The Method</h3>
<pre><code>
/**
 *  Send debug code to the Javascript console (PHP Console Debugging)
 */
function debug_to_console($data, $tag = 'JHONNY') {
  if(is_array($data) || is_object($data)) {
     echo("&lt;script&gt;console.log('" . $tag. ": " .json_encode($data)."');&lt;/script&gt;");
  } else {
     echo("&lt;script&gt;console.log('" . $tag. ": " .$data."');&lt;/script&gt;");
  }
}
</code></pre>
<p>When added to <code>functions.php</code> It allows me to call the function anywhere in my theme,<br />
The first argument <code>$data</code> &#8211; It&#8217;s the variable or array that I want to to see his state (the value).<br />
The second argument <code>$tag</code> &#8211; It&#8217;s an optional tag you can add, so as it is printed out in the console, you can identify it better.</p>
<h3><a href="#">#</a> On Small Projects</h3>
<p>On small projects mostly there is no need to add the second argument, so as it is above, it will alwyas just print <code>"JHONNY: "</code> before the variable, so I know that this is printed out from this function.<br />
So all you need to do is just give it the var you want to debug:</p>
<p><code>debug_to_console($tax_name)</code></p>
<p>It will look like this (In the browser console):</p>
<p><img decoding="async" loading="lazy" class="aligncenter wp-image-56 size-full mdl-shadow--4dp" src="http://sidecode.co.il/wp-content/uploads/debugSmallerProjects.jpg" alt="debugsmallerprojects" width="1004" height="333" /></p>
<h3><a href="#">#</a> On larger Projects</h3>
<p>On larger projects, usually, I add the second argument with the class name or tepmplate page it belongs to with the var name, something like:</p>
<p><code>debug_to_console($image_url,"footer.php - imageUrl")</code></p>
<p>It will look like this (In the browser console):</p>
<p><img decoding="async" loading="lazy" class="aligncenter wp-image-55 size-full mdl-shadow--4dp" src="http://sidecode.co.il/wp-content/uploads/debuglargerProject.jpg" alt="debuglargerproject" width="1000" height="336" /></p>
<p>The post <a rel="nofollow" href="https://sidecode.io/dev-blog/fast-wordpress-debugging-debug-to-console/">Fast WordPress Debugging (Debug to console)</a> appeared first on <a rel="nofollow" href="https://sidecode.io">SideCode</a>.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>

<!--
Performance optimized by W3 Total Cache. Learn more: https://www.boldgrid.com/w3-total-cache/

Object Caching 15/103 objects using disk
Page Caching using disk: enhanced 
Database Caching 10/54 queries in 0.063 seconds using disk

Served from: sidecode.io @ 2026-06-23 12:32:04 by W3 Total Cache
-->