<?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 tips - WP2X</title> <atom:link href="https://wp2x.com/tag/php-tips/feed/" rel="self" type="application/rss+xml" /><link>https://wp2x.com</link> <description>We can help your Wordpress faster</description> <lastBuildDate>Wed, 18 Nov 2015 10:37:19 +0000</lastBuildDate> <language>en-US</language> <sy:updatePeriod> hourly </sy:updatePeriod> <sy:updateFrequency> 1 </sy:updateFrequency> <generator>https://wordpress.org/?v=5.6.17</generator> <item><title>How to enable Gzip in .Htaccess for WordPress?</title><link>https://wp2x.com/how-to-enable-for-wordpress/</link> <dc:creator><![CDATA[david]]></dc:creator> <pubDate>Wed, 18 Nov 2015 10:37:19 +0000</pubDate> <category><![CDATA[Wordpress Tips]]></category> <category><![CDATA[php tips]]></category> <category><![CDATA[wordpress programming]]></category> <category><![CDATA[wordpress tips]]></category> <guid
isPermaLink="false">http://wp2x.com/?p=421</guid><description><![CDATA[<p>In case you have not heard of it in the past, Gzip is a server process that essentially compresses your files on the fly before transmission to the user. It is primarily used to compress text files such as HTML, CSS, and JavaScript with impressive results. Take the 90KB Mootools framework for example, Gzip reduces ...</p><p>The post <a
rel="nofollow" href="https://wp2x.com/how-to-enable-for-wordpress/">How to enable Gzip in .Htaccess for WordPress?</a> appeared first on <a
rel="nofollow" href="https://wp2x.com">WP2X</a>.</p> ]]></description> <content:encoded><![CDATA[<p>In case you have not heard of it in the past, Gzip is a server process that essentially compresses your files on the fly before transmission to the user. <span
id="more-421"></span>It is primarily used to compress text files such as HTML, CSS, and JavaScript with impressive results. Take the 90KB Mootools framework for example, Gzip reduces it to 26KB saving the visitor time and your bandwidth.</p><p><a
href="http://wp2x.com/wp-content/uploads/2015/11/gzip3d.png?4b2a2c&amp;4b2a2c"><img
loading="lazy" class="aligncenter size-full wp-image-422" src="http://wp2x.com/wp-content/uploads/2015/11/gzip3d.png?4b2a2c&amp;4b2a2c" alt="gzip3d" width="299" height="198" /></a></p><pre class="lang:ini decode:true ">#Gzip
&lt;ifmodule mod_deflate.c&gt;
AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript text/javascript
&lt;/ifmodule&gt;
#End Gzip</pre><p>If your hosting setup has Gzip enabled I highly recommend that you enable it in your .htaccess file by copying and pasting the above code into your .htaccess. If they don&#8217;t have it enabled, simply ask, most of the time they will simply enable it for you. It also comes recommended by Google and <a
href="http://developer.yahoo.com/performance/rules.html#gzip" target="_blank">Yahoo</a>.</p><p>The post <a
rel="nofollow" href="https://wp2x.com/how-to-enable-for-wordpress/">How to enable Gzip in .Htaccess for WordPress?</a> appeared first on <a
rel="nofollow" href="https://wp2x.com">WP2X</a>.</p> ]]></content:encoded> </item> <item><title>WordPress Hosting/Server System Requirements</title><link>https://wp2x.com/wordpress-hostingserver-system-requirements/</link> <dc:creator><![CDATA[david]]></dc:creator> <pubDate>Thu, 30 Jul 2015 11:14:42 +0000</pubDate> <category><![CDATA[Blog]]></category> <category><![CDATA[Wordpress Hosting]]></category> <category><![CDATA[best wordpress hosting]]></category> <category><![CDATA[php programming]]></category> <category><![CDATA[php tips]]></category> <category><![CDATA[php web hosting]]></category> <category><![CDATA[top wordpress hosting]]></category> <category><![CDATA[web hosting]]></category> <category><![CDATA[wordpress tips]]></category> <category><![CDATA[wordpress tutorial]]></category> <guid
isPermaLink="false">http://wp2x.com/?p=402</guid><description><![CDATA[<p>WordPress require a very small server configuration hardware and software. In this post, I only talk about the wordpress system requirements what enough to run wordpress (not wordpress fully optimized hosting what make wordpress work fast). Here is simple requirements When you use WordPress with system requirements, you can check these plugins for help</p><p>The post <a
rel="nofollow" href="https://wp2x.com/wordpress-hostingserver-system-requirements/">WordPress Hosting/Server System Requirements</a> appeared first on <a
rel="nofollow" href="https://wp2x.com">WP2X</a>.</p> ]]></description> <content:encoded><![CDATA[<p>WordPress require a very small server configuration hardware and software. In this post, I only talk about the wordpress system requirements what enough to run wordpress (not wordpress fully optimized hosting what make wordpress work fast).<span
id="more-402"></span></p><p><img
loading="lazy" class="aligncenter size-full wp-image-403" src="http://wp2x.com/wp-content/uploads/2015/07/Wordpress-Hosting-System-Requirements.jpg?4b2a2c&amp;4b2a2c" alt="Wordpress-Hosting-System-Requirements" width="606" height="306" srcset="https://wp2x.com/wp-content/uploads/2015/07/Wordpress-Hosting-System-Requirements.jpg 606w, https://wp2x.com/wp-content/uploads/2015/07/Wordpress-Hosting-System-Requirements-300x151.jpg 300w" sizes="(max-width: 606px) 100vw, 606px" /></p><p>Here is simple requirements<br
/><div
class="su-list" style="margin-left:0px"><ul><li><i
class="sui sui-check-square-o" style="color:#2fd730"></i> wOS: Linux/Unix/Mac/Windows</li><li><i
class="sui sui-check-square-o" style="color:#2fd730"></i> Web server: Apache/Nginx (or any web server support PHP well)</li><li><i
class="sui sui-check-square-o" style="color:#2fd730"></i> PHP 5.2.4 or greater</li><li><i
class="sui sui-check-square-o" style="color:#2fd730"></i> MySQL 5.0 or greater</li><li><i
class="sui sui-check-square-o" style="color:#2fd730"></i> The mod_rewrite Apache module</li></ul></div> When you use WordPress with system requirements, you can check these plugins for help<br
/><div
class="su-list" style="margin-left:0px"><ul><li><i
class="sui sui-check-square-o" style="color:#2fd730"></i> Library for handling minimum system requirements in WordPress Plugins:<a
href="https://github.com/dsawardekar/wp-requirements" target="_blank">https://github.com/dsawardekar/wp-requirements</a></li><li><i
class="sui sui-check-square-o" style="color:#2fd730"></i> System Requirements Check:<a
href="https://wordpress.org/plugins/system-requirements-check/" target="_blank">https://wordpress.org/plugins/system-requirements-check/</a></li></ul></div><p>The post <a
rel="nofollow" href="https://wp2x.com/wordpress-hostingserver-system-requirements/">WordPress Hosting/Server System Requirements</a> appeared first on <a
rel="nofollow" href="https://wp2x.com">WP2X</a>.</p> ]]></content:encoded> </item> <item><title>Get last character from string in PHP</title><link>https://wp2x.com/get-last-character-from-string-in-php/</link> <dc:creator><![CDATA[david]]></dc:creator> <pubDate>Sun, 19 Apr 2015 12:53:56 +0000</pubDate> <category><![CDATA[Wordpress Tips]]></category> <category><![CDATA[php programming]]></category> <category><![CDATA[php string]]></category> <category><![CDATA[php tips]]></category> <category><![CDATA[php wordpress]]></category> <category><![CDATA[wordpress tips]]></category> <category><![CDATA[wordpress tutorial]]></category> <guid
isPermaLink="false">http://wp2x.com/?p=361</guid><description><![CDATA[<p>Easy but not for all of us to get last character from string in PHP. It &#8216;s quite simple to figure out with a quick Google it. So if you found my article about this. Then you are in right place to solve this issuse with a simplest way. 1. Get the last char of a ...</p><p>The post <a
rel="nofollow" href="https://wp2x.com/get-last-character-from-string-in-php/">Get last character from string in PHP</a> appeared first on <a
rel="nofollow" href="https://wp2x.com">WP2X</a>.</p> ]]></description> <content:encoded><![CDATA[<p>Easy but not for all of us to get last character from string in PHP. It &#8216;s quite simple to figure out with a quick Google it. So if you found my article about this. Then you are in right place to solve this issuse with a simplest way.<span
id="more-361"></span></p><h2><a
href="http://wp2x.com/wp-content/uploads/2015/04/php-string.jpeg?4b2a2c&amp;4b2a2c"><img
loading="lazy" class="aligncenter size-full wp-image-362" src="http://wp2x.com/wp-content/uploads/2015/04/php-string.jpeg?4b2a2c&amp;4b2a2c" alt="php string" width="259" height="194" /></a></h2><h2>1. Get the last char of a string in PHP</h2><p>If you want to get the only one character in a string, here is simplest function to do.</p><pre class="lang:php decode:true">substr("testers", -1); // returns "s"</pre><p>So simple?</p><p>And what if you want 2 characters? Let &#8216;s do this</p><pre class="lang:default decode:true ">substr("testers", -2); // returns "rs"</pre><h2> 2. Remove the last character from string</h2><p>Just a bonus if this article, if you want to remove the last character in a string. You can do this function</p><pre class="lang:php decode:true ">substr("a,b,c,d,e,", 0, -1);</pre><p>The output is a,b,c,d,e</p><p>Hope this article help you solve the problem with string.</p><p>Thanks</p><p>The post <a
rel="nofollow" href="https://wp2x.com/get-last-character-from-string-in-php/">Get last character from string in PHP</a> appeared first on <a
rel="nofollow" href="https://wp2x.com">WP2X</a>.</p> ]]></content:encoded> </item> <item><title>Extract youtube ID from youtube URL in PHP</title><link>https://wp2x.com/extract-youtube-id-from-youtube-url-in-php/</link> <dc:creator><![CDATA[david]]></dc:creator> <pubDate>Tue, 10 Mar 2015 10:50:05 +0000</pubDate> <category><![CDATA[Wordpress Tips]]></category> <category><![CDATA[php programming]]></category> <category><![CDATA[php tips]]></category> <category><![CDATA[wordpress tips]]></category> <category><![CDATA[youtube]]></category> <category><![CDATA[youtube id]]></category> <guid
isPermaLink="false">http://wp2x.com/?p=350</guid><description><![CDATA[<p>Today I will show you a very easy way to Extract youtube ID from youtube URL in PHP. This is very simple task what shouldn&#8217;t take time but we usually do it not official with all of situations. It &#8216;s very simple, you just need to run this wayway function getIDFromYoutubeURL($url){ $video_id = false; if (preg_match('%(?:youtube(?:-nocookie)?\.com/(?:[^/]+/.+/&#124;(?:v&#124;e(?:mbed)?)/&#124;.*[?&#38;]v=)&#124;youtu\.be/)([^"&#38;?/ ...</p><p>The post <a
rel="nofollow" href="https://wp2x.com/extract-youtube-id-from-youtube-url-in-php/">Extract youtube ID from youtube URL in PHP</a> appeared first on <a
rel="nofollow" href="https://wp2x.com">WP2X</a>.</p> ]]></description> <content:encoded><![CDATA[<p>Today I will show you a very easy way to Extract youtube ID from youtube URL in PHP. This is very simple task what shouldn&#8217;t take time but we usually do it not official with all of situations.<span
id="more-350"></span></p><p><a
href="http://wp2x.com/wp-content/uploads/2015/03/YouTube-Content-ID.jpeg?4b2a2c&amp;4b2a2c"><img
loading="lazy" class="aligncenter size-full wp-image-351" src="http://wp2x.com/wp-content/uploads/2015/03/YouTube-Content-ID.jpeg?4b2a2c&amp;4b2a2c" alt="YouTube-Content-ID" width="200" height="212" /></a></p><p>It &#8216;s very simple, you just need to run this wayway</p><pre class="lang:php decode:true">function getIDFromYoutubeURL($url){
        $video_id = false;
        if (preg_match('%(?:youtube(?:-nocookie)?\.com/(?:[^/]+/.+/|(?:v|e(?:mbed)?)/|.*[?&amp;]v=)|youtu\.be/)([^"&amp;?/ ]{11})%i', $url, $match)) {
            $video_id = $match[1];
        }
        return $video_id;
    }</pre><p>Now let &#8216;s use function like this</p><pre class="lang:default decode:true ">$youtubeID = getIDFromYoutubeURL("https://www.youtube.com/watch?v=_URzW7CH8Dg");

// $youtubeID = _URzW7CH8Dg</pre><p>&nbsp;</p><p>The post <a
rel="nofollow" href="https://wp2x.com/extract-youtube-id-from-youtube-url-in-php/">Extract youtube ID from youtube URL in PHP</a> appeared first on <a
rel="nofollow" href="https://wp2x.com">WP2X</a>.</p> ]]></content:encoded> </item> <item><title>PHP function to display time ago base on timestamp</title><link>https://wp2x.com/php-function-display-time-ago-base-timestamp/</link> <comments>https://wp2x.com/php-function-display-time-ago-base-timestamp/#comments</comments> <dc:creator><![CDATA[david]]></dc:creator> <pubDate>Wed, 03 Dec 2014 10:21:56 +0000</pubDate> <category><![CDATA[Wordpress Tips]]></category> <category><![CDATA[php function]]></category> <category><![CDATA[php tips]]></category> <category><![CDATA[time ago]]></category> <guid
isPermaLink="false">http://wp2x.com/?p=326</guid><description><![CDATA[<p>Timestamp in PHP only for system usage, for user we have to show it in easy to read way like: 1 minutes ago, 1 hour ago &#8230; Today I will show you to use PHP function to display time ago base on timestamp. Here is very simple PHP function what you can use in any PHP ...</p><p>The post <a
rel="nofollow" href="https://wp2x.com/php-function-display-time-ago-base-timestamp/">PHP function to display time ago base on timestamp</a> appeared first on <a
rel="nofollow" href="https://wp2x.com">WP2X</a>.</p> ]]></description> <content:encoded><![CDATA[<p>Timestamp in PHP only for system usage, for user we have to show it in easy to read way like: 1 minutes ago, 1 hour ago &#8230; Today I will show you to use PHP function to display time ago base on timestamp.<span
id="more-326"></span></p><p><a
href="http://wp2x.com/wp-content/uploads/2014/12/php-function-time-ago.png?4b2a2c&amp;4b2a2c"><img
loading="lazy" class="aligncenter size-full wp-image-327" src="http://wp2x.com/wp-content/uploads/2014/12/php-function-time-ago.png?4b2a2c&amp;4b2a2c" alt="php function time ago" width="728" height="546" srcset="https://wp2x.com/wp-content/uploads/2014/12/php-function-time-ago.png 728w, https://wp2x.com/wp-content/uploads/2014/12/php-function-time-ago-300x225.png 300w" sizes="(max-width: 728px) 100vw, 728px" /></a>Here is very simple PHP function what you can use in any PHP project to display time.</p><pre class="lang:php decode:true ">&lt;?php
function timeAgo($time_ago){
$cur_time 	= time();
$time_elapsed 	= $cur_time - $time_ago;
$seconds 	= $time_elapsed ;
$minutes 	= round($time_elapsed / 60 );
$hours 		= round($time_elapsed / 3600);
$days 		= round($time_elapsed / 86400 );
$weeks 		= round($time_elapsed / 604800);
$months 	= round($time_elapsed / 2600640 );
$years 		= round($time_elapsed / 31207680 );
// Seconds
if($seconds &lt;= 60){
	echo "$seconds seconds ago";
}
//Minutes
else if($minutes &lt;=60){
	if($minutes==1){
		echo "one minute ago";
	}
	else{
		echo "$minutes minutes ago";
	}
}
//Hours
else if($hours &lt;=24){
	if($hours==1){
		echo "an hour ago";
	}else{
		echo "$hours hours ago";
	}
}
//Days
else if($days &lt;= 7){
	if($days==1){
		echo "yesterday";
	}else{
		echo "$days days ago";
	}
}
//Weeks
else if($weeks &lt;= 4.3){
	if($weeks==1){
		echo "a week ago";
	}else{
		echo "$weeks weeks ago";
	}
}
//Months
else if($months &lt;=12){
	if($months==1){
		echo "a month ago";
	}else{
		echo "$months months ago";
	}
}
//Years
else{
	if($years==1){
		echo "one year ago";
	}else{
		echo "$years years ago";
	}
}
}

?&gt;</pre><p>Now, time to show and use it &#8216;s quite simple like this</p><pre class="lang:php decode:true ">&lt;?php
  $curenttime="2013-07-10 09:09:09";
  $time_ago =strtotime($curenttime);
  echo timeAgo($time_ago);
?&gt;</pre><p>You will see the output like this</p><pre class="lang:default decode:true ">one year ago</pre><p>&nbsp;</p><p>&nbsp;</p><p>The post <a
rel="nofollow" href="https://wp2x.com/php-function-display-time-ago-base-timestamp/">PHP function to display time ago base on timestamp</a> appeared first on <a
rel="nofollow" href="https://wp2x.com">WP2X</a>.</p> ]]></content:encoded> <wfw:commentRss>https://wp2x.com/php-function-display-time-ago-base-timestamp/feed/</wfw:commentRss> <slash:comments>2</slash:comments> </item> </channel> </rss>