<?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 programming - WP2X</title> <atom:link href="https://wp2x.com/tag/php-programming/feed/" rel="self" type="application/rss+xml" /><link>https://wp2x.com</link> <description>We can help your Wordpress faster</description> <lastBuildDate>Thu, 23 Jul 2015 11:17:22 +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>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 with prefix 0 for a number</title><link>https://wp2x.com/php-prefix-0-number/</link> <comments>https://wp2x.com/php-prefix-0-number/#comments</comments> <dc:creator><![CDATA[david]]></dc:creator> <pubDate>Sat, 23 Aug 2014 04:57:35 +0000</pubDate> <category><![CDATA[Blog]]></category> <category><![CDATA[Wordpress Tips]]></category> <category><![CDATA[php programming]]></category> <guid
isPermaLink="false">http://wp2x.com/?p=250</guid><description><![CDATA[<p>Today when I try to generate the Student ID for a school project I meet a problem what I think almost us will meet. By the way, I figured out a very good way to solve it so that I decide to share to here. My problem with PHP in number prefix 0 My customer ...</p><p>The post <a
rel="nofollow" href="https://wp2x.com/php-prefix-0-number/">PHP with prefix 0 for a number</a> appeared first on <a
rel="nofollow" href="https://wp2x.com">WP2X</a>.</p> ]]></description> <content:encoded><![CDATA[<p>Today when I try to generate the Student ID for a school project I meet a problem what I think almost us will meet. By the way, I figured out a very good way to solve it so that I decide to share to here.<span
id="more-250"></span></p><p><a
href="http://wp2x.com/wp-content/uploads/2014/08/PHP-with-prefix-0-for-a-number.jpg?4b2a2c&amp;4b2a2c"><img
loading="lazy" class="aligncenter size-full wp-image-251" src="http://wp2x.com/wp-content/uploads/2014/08/PHP-with-prefix-0-for-a-number.jpg?4b2a2c&amp;4b2a2c" alt="PHP with prefix 0 for a number" width="285" height="177" /></a></p><h2>My problem with PHP in number prefix 0</h2><p>My customer want to generate the number like this</p><p><strong>&lt;year-4 digits&gt;&lt;class name-string&gt;&lt;ID &#8211; 4 digits&gt;</strong></p><p>With ID need to generate auto increase, if it is not enough 4 digits then put &#8220;0&#8221; as prefix to get it enough. It will look like this</p><p>201410A10013</p><p>Year: 2014</p><p>Class name: 10A1</p><p>ID: 0013</p><p>What we need to do is finding a good way to put &#8220;0&#8221; for enough 4 digits.</p><h2>My solution</h2><p>Ok, and this is the way I do, it &#8216;s very simple</p><pre class="lang:php decode:true ">$studentID =  $Y . $C . sprintf("%04s",   $ID);</pre><p>With $studentID is the final result</p><p>$Y is the current year. You can generate it easy</p><p>$Y = date(&#8216;Y&#8217;);</p><p>$C is the class name, you get it from your system.</p><p>And $ID is the number you generate from your system. You need to make sure it &#8216;s string before doing this.</p><p>$ID .= &#8220;&#8221;;</p><h2>Final PHP code</h2><pre class="lang:php decode:true ">$Y = date('Y');

$C = "10A1"; // change to your class

$ID = 13; // change to your ID

$ID .= ""; // make sure it 's string

$studentID =  $Y . $C . sprintf("%04s",   $ID);</pre><p>Enjoy and good luck</p><p>The post <a
rel="nofollow" href="https://wp2x.com/php-prefix-0-number/">PHP with prefix 0 for a number</a> appeared first on <a
rel="nofollow" href="https://wp2x.com">WP2X</a>.</p> ]]></content:encoded> <wfw:commentRss>https://wp2x.com/php-prefix-0-number/feed/</wfw:commentRss> <slash:comments>5</slash:comments> </item> <item><title>PHP remove value in array</title><link>https://wp2x.com/php-remove-value-array/</link> <dc:creator><![CDATA[david]]></dc:creator> <pubDate>Thu, 14 Aug 2014 00:52:41 +0000</pubDate> <category><![CDATA[Blog]]></category> <category><![CDATA[Wordpress Tips]]></category> <category><![CDATA[php programming]]></category> <guid
isPermaLink="false">http://wp2x.com/?p=244</guid><description><![CDATA[<p>As always, I would like to share whatever I meet in my programming work and hope it will save your time in your development. &#160; Today, when I try to remove a value out of an array and figured out the best way to do. Here is my simple code: [php]if(($key = array_search($device_id, $device_ids)) !== ...</p><p>The post <a
rel="nofollow" href="https://wp2x.com/php-remove-value-array/">PHP remove value in array</a> appeared first on <a
rel="nofollow" href="https://wp2x.com">WP2X</a>.</p> ]]></description> <content:encoded><![CDATA[<p>As always, I would like to share whatever I meet in my programming work and hope it will save your time in your development.</p><p><span
id="more-244"></span></p><p><a
href="http://wp2x.com/wp-content/uploads/2014/08/generic-php.jpg?4b2a2c&amp;4b2a2c"><img
loading="lazy" class="aligncenter size-full wp-image-245" src="http://wp2x.com/wp-content/uploads/2014/08/generic-php.jpg?4b2a2c&amp;4b2a2c" alt="generic-php" width="590" height="120" srcset="https://wp2x.com/wp-content/uploads/2014/08/generic-php.jpg 590w, https://wp2x.com/wp-content/uploads/2014/08/generic-php-300x61.jpg 300w" sizes="(max-width: 590px) 100vw, 590px" /></a></p><p>&nbsp;</p><p>Today, when I try to remove a value out of an array and figured out the best way to do. Here is my simple code:</p> [php]if(($key = array_search($device_id, $device_ids)) !== false) {<br
/> unset($device_ids[$key]);<br
/> }[/php]<p>Above code, I want to remove a knew value of <strong>device_id</strong> out of a <strong>device_ids</strong> list. It &#8216;s quite simple and save us a lot of time to use foreach statement.</p><p>Hope it help.</p><p>The post <a
rel="nofollow" href="https://wp2x.com/php-remove-value-array/">PHP remove value in array</a> appeared first on <a
rel="nofollow" href="https://wp2x.com">WP2X</a>.</p> ]]></content:encoded> </item> <item><title>Round and Format number in PHP</title><link>https://wp2x.com/round-format-number-in-php/</link> <dc:creator><![CDATA[david]]></dc:creator> <pubDate>Thu, 17 Jul 2014 04:05:27 +0000</pubDate> <category><![CDATA[Blog]]></category> <category><![CDATA[Wordpress Tips]]></category> <category><![CDATA[php programming]]></category> <category><![CDATA[wordpress tips]]></category> <guid
isPermaLink="false">http://wp2x.com/?p=224</guid><description><![CDATA[<p>Making Round and Format number in PHP is quite easy but it will take you much time if you are not familiar with it. But here we help you solve all of these type of issues just in 5 minutes :). First of all, if you worry about the PHP version or what people are talking about ...</p><p>The post <a
rel="nofollow" href="https://wp2x.com/round-format-number-in-php/">Round and Format number in PHP</a> appeared first on <a
rel="nofollow" href="https://wp2x.com">WP2X</a>.</p> ]]></description> <content:encoded><![CDATA[<p>Making <strong>Round and Format number in PHP</strong> is quite easy but it will take you much time if you are not familiar with it. But here we help you solve all of these type of issues just in 5 minutes :).<span
id="more-224"></span></p><p><img
loading="lazy" class="aligncenter size-full wp-image-225" src="http://wp2x.com/wp-content/uploads/2014/07/format-and-round-number-in-php.jpg?4b2a2c&amp;4b2a2c" alt="format and round number in php" width="512" height="512" srcset="https://wp2x.com/wp-content/uploads/2014/07/format-and-round-number-in-php.jpg 512w, https://wp2x.com/wp-content/uploads/2014/07/format-and-round-number-in-php-150x150.jpg 150w, https://wp2x.com/wp-content/uploads/2014/07/format-and-round-number-in-php-300x300.jpg 300w, https://wp2x.com/wp-content/uploads/2014/07/format-and-round-number-in-php-80x80.jpg 80w, https://wp2x.com/wp-content/uploads/2014/07/format-and-round-number-in-php-266x266.jpg 266w, https://wp2x.com/wp-content/uploads/2014/07/format-and-round-number-in-php-184x184.jpg 184w" sizes="(max-width: 512px) 100vw, 512px" /></p><p>First of all, if you worry about the PHP version or what people are talking about this, you can follow this link on PHP official page <a
href="http://php.net/manual/en/function.round.php" target="_blank">http://php.net/manual/en/function.round.php</a></p> [code]float round ( float $val [, int $precision = 0 [, int $mode = PHP_ROUND_HALF_UP ]] )[/code]
[code]string number_format ( float $number , int $decimals = 0 , string $dec_point = &#8220;.&#8221; , string $thousands_sep = &#8220;,&#8221; )[/code]<p>Now, let &#8216;s start</p><h2>1. Round number in PHP</h2><p>It &#8216;s easier than you thought, we have some basic ways to use it here</p><pre class="lang:php decode:true">echo round(9.5, 0, PHP_ROUND_HALF_UP); // 10
echo round(9.5, 0, PHP_ROUND_HALF_DOWN); // 9
echo round(9.5, 0, PHP_ROUND_HALF_EVEN); // 10
echo round(9.5, 0, PHP_ROUND_HALF_ODD); // 9</pre><p>Keep in mind that, the difference from round and format is the value. When you try to format a number, it only mean you show it to user the different way, but when you use round, you already change the value to value you want. We will talk more about format later, here if you want to get 3 numbers after decimal point, you can use like this</p><pre class="lang:php decode:true ">ceil( 2.412345 * 1000)/1000;</pre><p>&nbsp;</p><p>It will give you 2.412</p><p>I think that &#8216;s all you need to round a number in PHP</p><h2>2. Format number in PHP</h2><p>Let &#8216;s continue with format number in PHP by an simple example</p><pre class="lang:php decode:true ">$number = 1234.56;

// english notation (default)
$english_format_number = number_format($number);
// 1,235

// French notation
$nombre_format_francais = number_format($number, 2, ',', ' ');
// 1 234,56

$number = 1234.5678;

// english notation without thousands separator
$english_format_number = number_format($number, 2, '.', '');
// 1234.57</pre><p>&nbsp;</p><p>And I believe you know how to use after looking at this example.</p><p>By this article, I hope to help you solve almost issue about <strong>Round and Format number in PHP.</strong></p><p>Good luck!</p><p>The post <a
rel="nofollow" href="https://wp2x.com/round-format-number-in-php/">Round and Format number in PHP</a> appeared first on <a
rel="nofollow" href="https://wp2x.com">WP2X</a>.</p> ]]></content:encoded> </item> </channel> </rss>