<?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>Snippets &#8211; TUTORIALS PAGE</title>
	<atom:link href="https://tutorialspage.com/category/snippets/feed/" rel="self" type="application/rss+xml" />
	<link>https://tutorialspage.com</link>
	<description>Free tutorials and daily notes</description>
	<lastBuildDate>Sat, 30 Oct 2021 21:58:53 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	
<site xmlns="com-wordpress:feed-additions:1">105742871</site>	<item>
		<title>Using preg_split() to explode() by multiple delimiters in PHP</title>
		<link>https://tutorialspage.com/using-preg_split-to-explode-by-multiple-delimiters-in-php/</link>
					<comments>https://tutorialspage.com/using-preg_split-to-explode-by-multiple-delimiters-in-php/#respond</comments>
		
		<dc:creator><![CDATA[cata]]></dc:creator>
		<pubDate>Mon, 05 Feb 2018 11:20:58 +0000</pubDate>
				<category><![CDATA[Snippets]]></category>
		<guid isPermaLink="false">http://tutorialspage.com/?p=1547</guid>

					<description><![CDATA[Just a quick note here. To [crayon-6a401e2ab75b6561849903-i/]  a string using multiple delimiters in PHP you will have to make use of the regular expressions. Use pipe character to separate your delimiters. [crayon-6a401e2ab75c1812857647/] There are also various flags you can use as optional: PREG_SPLIT_NO_EMPTY  &#8211; To return only non-empty pieces. PREG_SPLIT_DELIM_CAPTURE &#8211; To capture and return the parenthesized expression &#8230; <a href="https://tutorialspage.com/using-preg_split-to-explode-by-multiple-delimiters-in-php/" class="more-link">Continue reading<span class="screen-reader-text"> "Using preg_split() to explode() by multiple delimiters in PHP"</span></a>]]></description>
										<content:encoded><![CDATA[<p>Just a quick note here. To 
			<span id="urvanov-syntax-highlighter-6a401e2ab75b6561849903" class="urvanov-syntax-highlighter-syntax urvanov-syntax-highlighter-syntax-inline  crayon-theme-monokai crayon-theme-monokai-inline urvanov-syntax-highlighter-font-courier-new" style="font-size: 12px !important; line-height: 25px !important;font-size: 12px !important;"><span class="crayon-pre urvanov-syntax-highlighter-code" style="font-size: 12px !important; line-height: 25px !important;font-size: 12px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;"><span class="crayon-e">explode</span><span class="crayon-sy">(</span><span class="crayon-sy">)</span></span></span>  a string using multiple delimiters in PHP you will have to make use of the regular expressions. Use pipe character to separate your delimiters.</p><pre class="urvanov-syntax-highlighter-plain-tag">$chunks = preg_split('/(de1|del2|del3)/',$string,-1, PREG_SPLIT_NO_EMPTY);</pre><p>There are also various flags you can use as optional:<span id="more-1547"></span></p>
<ul>
<li>PREG_SPLIT_NO_EMPTY  &#8211; To return only non-empty pieces.</li>
<li>PREG_SPLIT_DELIM_CAPTURE &#8211; To capture and return the parenthesized expression in the delimiter.</li>
<li>PREG_SPLIT_OFFSET_CAPTURE &#8211; To return the appendant string offset for every occurring match.</li>
</ul>
<p>Here is a simple example of usage:</p><pre class="urvanov-syntax-highlighter-plain-tag">$string = '
&lt;ul&gt;
	&lt;li&gt;Name: John&lt;/li&gt;
	&lt;li&gt;Surname- Doe&lt;/li&gt;
	&lt;li&gt;Phone* 555 0456789&lt;/li&gt;
	&lt;li&gt;Zip code= ZP5689&lt;/li&gt;
&lt;/ul&gt;
';

$chunks = preg_split('/(:|-|\*|=)/', $string,-1, PREG_SPLIT_NO_EMPTY);

// This is just a simple way to debug stuff ;-)
echo '&lt;pre&gt;';
print_r($chunks);
echo '&lt;/pre&gt;';</pre><p>&#8230;and this is the output:</p><pre class="urvanov-syntax-highlighter-plain-tag">&lt;pre&gt;Array
(
    [0] =&gt; 
&lt;ul&gt;
	&lt;li&gt;Name
    [1] =&gt;  John&lt;/li&gt;
	&lt;li&gt;Surname 
    [2] =&gt;  Doe&lt;/li&gt;
	&lt;li&gt;Phone
    [3] =&gt;  555 0456789&lt;/li&gt;
	&lt;li&gt;Address 
    [4] =&gt;  Str Preg Split example&lt;/li&gt;
	&lt;li&gt;Zip code 
    [5] =&gt;  ZP5689&lt;/li&gt;
&lt;/ul&gt;

)
&lt;/pre&gt;</pre><p>Now let&#8217;s put everything back together in a nice form.</p><pre class="urvanov-syntax-highlighter-plain-tag">$nweString = $chunks[0];
for($i=1; $i&lt;count($chunks); $i++) {
	$nweString .= ':'.$chunks[$i];
}
echo $nweString;</pre><p><img data-recalc-dims="1" fetchpriority="high" decoding="async" class="alignnone size-full wp-image-1548" src="https://i0.wp.com/tutorialspage.com/wp-content/uploads/2018/02/preg_split.png?resize=536%2C96&#038;ssl=1" alt="" width="536" height="96" srcset="https://i0.wp.com/tutorialspage.com/wp-content/uploads/2018/02/preg_split.png?w=536&amp;ssl=1 536w, https://i0.wp.com/tutorialspage.com/wp-content/uploads/2018/02/preg_split.png?resize=300%2C54&amp;ssl=1 300w" sizes="(max-width: 536px) 85vw, 536px" /></p>
<p>Enjoy this simple, yet powerful way to split a string by multiple delimiters in PHP. You can further read about the 
			<span id="urvanov-syntax-highlighter-6a401e2ab75d7556817905" class="urvanov-syntax-highlighter-syntax urvanov-syntax-highlighter-syntax-inline  crayon-theme-monokai crayon-theme-monokai-inline urvanov-syntax-highlighter-font-courier-new" style="font-size: 12px !important; line-height: 25px !important;font-size: 12px !important;"><span class="crayon-pre urvanov-syntax-highlighter-code" style="font-size: 12px !important; line-height: 25px !important;font-size: 12px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;"><span class="crayon-e">preg_split</span><span class="crayon-sy">(</span><span class="crayon-sy">)</span></span></span>  function on the PHP documentation site here <a href="http://php.net/manual/en/function.preg-split.php"> http://php.net/manual/en/function.preg-split.php</a></p>
]]></content:encoded>
					
					<wfw:commentRss>https://tutorialspage.com/using-preg_split-to-explode-by-multiple-delimiters-in-php/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">1547</post-id>	</item>
		<item>
		<title>Remove admin bar wordpress backend and frontend</title>
		<link>https://tutorialspage.com/remove-admin-bar-wordpress-backend-and-frontend/</link>
					<comments>https://tutorialspage.com/remove-admin-bar-wordpress-backend-and-frontend/#respond</comments>
		
		<dc:creator><![CDATA[cata]]></dc:creator>
		<pubDate>Tue, 13 Dec 2016 22:21:55 +0000</pubDate>
				<category><![CDATA[Snippets]]></category>
		<category><![CDATA[WordPress]]></category>
		<guid isPermaLink="false">http://tutorialspage.com/?p=936</guid>

					<description><![CDATA[So, as mentioned above, supposedly the new Toolbar is meant to be impossible to remove. The reason for this is that the new Toolbar is a combination between the old Admin Bar and the Dashboard Header. If you remove the Toolbar, then you are effectively removing the Dashboard Header, which is something the folks at &#8230; <a href="https://tutorialspage.com/remove-admin-bar-wordpress-backend-and-frontend/" class="more-link">Continue reading<span class="screen-reader-text"> "Remove admin bar wordpress backend and frontend"</span></a>]]></description>
										<content:encoded><![CDATA[<p>So, as mentioned above, supposedly the new Toolbar is meant to be impossible to remove. The reason for this is that the new Toolbar is a combination between the old Admin Bar and the Dashboard Header.</p>
<p>If you remove the Toolbar, then you are effectively removing the Dashboard Header, which is something the folks at WordPress don’t think you should be doing.<span id="more-936"></span></p>
<h3>Is it Impossible to Remove the Toolbar?</h3>
<p>The toolbar, where the Admin Bar was in old versions, contains vital links for you to log-out, and the links to go back to the main site. It <strong>CANNOT be disabled</strong>, and has no hooks to be disabled it. Besides if you are using Multisite, all the network admin links are in there.</p>
<p>On the other hand <strong>you CAN</strong> however <strong>turn it off on the front end</strong> in your profile. Remember this is only for your profile.</p>
<p><img data-recalc-dims="1" decoding="async" class="alignnone size-full wp-image-1309" src="https://i0.wp.com/tutorialspage.com/wp-content/uploads/2016/12/toolbar-option.png?resize=735%2C304&#038;ssl=1" alt="" width="735" height="304" srcset="https://i0.wp.com/tutorialspage.com/wp-content/uploads/2016/12/toolbar-option.png?w=735&amp;ssl=1 735w, https://i0.wp.com/tutorialspage.com/wp-content/uploads/2016/12/toolbar-option.png?resize=300%2C124&amp;ssl=1 300w" sizes="(max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 984px) 61vw, (max-width: 1362px) 45vw, 600px" /></p>
<p>If you would like to accomplish the same thing for all your users (remember this is just for the front end toolbar) you can place the following into your functions.php file.</p><pre class="urvanov-syntax-highlighter-plain-tag">function remove_admin_tolbar_on_frontend() {
	remove_action('wp_head', '_admin_bar_bump_cb');
}
add_action('get_header', 'remove_admin_tolbar_on_frontend');</pre><p>There are also tons of plugins that can help you a hide the toolbar. You can get one from here: <a href="https://wordpress.org/plugins/search.php?type=term&amp;q=remove+admin+bar">https://wordpress.org/plugins/search.php?type=term&amp;q=remove+admin+bar</a></p>
<p>Some are using the same practice explained here and some are only hiding it using css. Note that if you are using CSS the admin toolbar is still loaded but not displayed to the user.</p>
<p>&nbsp;</p>
]]></content:encoded>
					
					<wfw:commentRss>https://tutorialspage.com/remove-admin-bar-wordpress-backend-and-frontend/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">936</post-id>	</item>
		<item>
		<title>PHP logical operators true false</title>
		<link>https://tutorialspage.com/php-logical-operators-true-false/</link>
					<comments>https://tutorialspage.com/php-logical-operators-true-false/#respond</comments>
		
		<dc:creator><![CDATA[cata]]></dc:creator>
		<pubDate>Tue, 13 Dec 2016 10:33:25 +0000</pubDate>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Snippets]]></category>
		<guid isPermaLink="false">http://tutorialspage.com/?p=940</guid>

					<description><![CDATA[The [crayon-6a401e2ab7c8b061597716-i/]  and [crayon-6a401e2ab7c94199626097-i/]  logical operators seem to have more general recognition and background usage, although the [crayon-6a401e2ab7c9a068335187-i/]  and [crayon-6a401e2ab7c9f228437496-i/]  form of the same logical operators is taking more and more acceptation for the sake of readability. So here is a list for the results when evaluating the expressions in PHP. I am sure that this &#8230; <a href="https://tutorialspage.com/php-logical-operators-true-false/" class="more-link">Continue reading<span class="screen-reader-text"> "PHP logical operators true false"</span></a>]]></description>
										<content:encoded><![CDATA[<p>The 
			<span id="urvanov-syntax-highlighter-6a401e2ab7c8b061597716" class="urvanov-syntax-highlighter-syntax urvanov-syntax-highlighter-syntax-inline  crayon-theme-monokai crayon-theme-monokai-inline urvanov-syntax-highlighter-font-courier-new" style="font-size: 12px !important; line-height: 25px !important;font-size: 12px !important;"><span class="crayon-pre urvanov-syntax-highlighter-code" style="font-size: 12px !important; line-height: 25px !important;font-size: 12px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;"><span class="crayon-o">&amp;&amp;</span></span></span>  and 
			<span id="urvanov-syntax-highlighter-6a401e2ab7c94199626097" class="urvanov-syntax-highlighter-syntax urvanov-syntax-highlighter-syntax-inline  crayon-theme-monokai crayon-theme-monokai-inline urvanov-syntax-highlighter-font-courier-new" style="font-size: 12px !important; line-height: 25px !important;font-size: 12px !important;"><span class="crayon-pre urvanov-syntax-highlighter-code" style="font-size: 12px !important; line-height: 25px !important;font-size: 12px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;"><span class="crayon-o">||</span></span></span>  <strong>logical operators</strong> seem to have more general recognition and background usage, although the 
			<span id="urvanov-syntax-highlighter-6a401e2ab7c9a068335187" class="urvanov-syntax-highlighter-syntax urvanov-syntax-highlighter-syntax-inline  crayon-theme-monokai crayon-theme-monokai-inline urvanov-syntax-highlighter-font-courier-new" style="font-size: 12px !important; line-height: 25px !important;font-size: 12px !important;"><span class="crayon-pre urvanov-syntax-highlighter-code" style="font-size: 12px !important; line-height: 25px !important;font-size: 12px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;"><span class="crayon-st">and</span></span></span>  and 
			<span id="urvanov-syntax-highlighter-6a401e2ab7c9f228437496" class="urvanov-syntax-highlighter-syntax urvanov-syntax-highlighter-syntax-inline  crayon-theme-monokai crayon-theme-monokai-inline urvanov-syntax-highlighter-font-courier-new" style="font-size: 12px !important; line-height: 25px !important;font-size: 12px !important;"><span class="crayon-pre urvanov-syntax-highlighter-code" style="font-size: 12px !important; line-height: 25px !important;font-size: 12px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;"><span class="crayon-st">or</span></span></span>  form of the same logical operators is taking more and <strong>more acceptation for the sake of readability</strong>.</p>
<p>So here is a list for the results when evaluating the expressions in <strong>PHP</strong>. I am sure that this can be applied to a bunch of other languages. (I think it is a little bit superficial to say that it apply to all programming language since I only know some of them).<span id="more-940"></span></p>
<p><strong>Logical operator 
			<span id="urvanov-syntax-highlighter-6a401e2ab7ca3481787571" class="urvanov-syntax-highlighter-syntax urvanov-syntax-highlighter-syntax-inline  crayon-theme-monokai crayon-theme-monokai-inline urvanov-syntax-highlighter-font-courier-new" style="font-size: 12px !important; line-height: 25px !important;font-size: 12px !important;"><span class="crayon-pre urvanov-syntax-highlighter-code" style="font-size: 12px !important; line-height: 25px !important;font-size: 12px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;"><span class="crayon-st">AND</span></span></span>  (
			<span id="urvanov-syntax-highlighter-6a401e2ab7ca8421956322" class="urvanov-syntax-highlighter-syntax urvanov-syntax-highlighter-syntax-inline  crayon-theme-monokai crayon-theme-monokai-inline urvanov-syntax-highlighter-font-courier-new" style="font-size: 12px !important; line-height: 25px !important;font-size: 12px !important;"><span class="crayon-pre urvanov-syntax-highlighter-code" style="font-size: 12px !important; line-height: 25px !important;font-size: 12px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;"><span class="crayon-o">&amp;&amp;</span></span></span> )</strong></p><pre class="urvanov-syntax-highlighter-plain-tag">false and false =&gt; false

false and true =&gt; false

true and false =&gt; false

true and true =&gt; true</pre><p>&nbsp;</p>
<p><strong>Logical operator 
			<span id="urvanov-syntax-highlighter-6a401e2ab7cb2545079874" class="urvanov-syntax-highlighter-syntax urvanov-syntax-highlighter-syntax-inline  crayon-theme-monokai crayon-theme-monokai-inline urvanov-syntax-highlighter-font-courier-new" style="font-size: 12px !important; line-height: 25px !important;font-size: 12px !important;"><span class="crayon-pre urvanov-syntax-highlighter-code" style="font-size: 12px !important; line-height: 25px !important;font-size: 12px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;"><span class="crayon-st">OR</span></span></span>  (
			<span id="urvanov-syntax-highlighter-6a401e2ab7cb7822718686" class="urvanov-syntax-highlighter-syntax urvanov-syntax-highlighter-syntax-inline  crayon-theme-monokai crayon-theme-monokai-inline urvanov-syntax-highlighter-font-courier-new" style="font-size: 12px !important; line-height: 25px !important;font-size: 12px !important;"><span class="crayon-pre urvanov-syntax-highlighter-code" style="font-size: 12px !important; line-height: 25px !important;font-size: 12px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;"><span class="crayon-o">||</span></span></span> )</strong></p><pre class="urvanov-syntax-highlighter-plain-tag">false or false =&gt; false

false or true =&gt; true

true or false =&gt; true

true or true =&gt; true</pre><p>&nbsp;</p>
<p><strong>Logical operator 
			<span id="urvanov-syntax-highlighter-6a401e2ab7cbf426332875" class="urvanov-syntax-highlighter-syntax urvanov-syntax-highlighter-syntax-inline  crayon-theme-monokai crayon-theme-monokai-inline urvanov-syntax-highlighter-font-courier-new" style="font-size: 12px !important; line-height: 25px !important;font-size: 12px !important;"><span class="crayon-pre urvanov-syntax-highlighter-code" style="font-size: 12px !important; line-height: 25px !important;font-size: 12px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;"><span class="crayon-st">NOT</span></span></span>  (
			<span id="urvanov-syntax-highlighter-6a401e2ab7cc4542788613" class="urvanov-syntax-highlighter-syntax urvanov-syntax-highlighter-syntax-inline  crayon-theme-monokai crayon-theme-monokai-inline urvanov-syntax-highlighter-font-courier-new" style="font-size: 12px !important; line-height: 25px !important;font-size: 12px !important;"><span class="crayon-pre urvanov-syntax-highlighter-code" style="font-size: 12px !important; line-height: 25px !important;font-size: 12px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;"><span class="crayon-o">!</span></span></span> )</strong></p><pre class="urvanov-syntax-highlighter-plain-tag">!false =&gt; true

!true =&gt; false</pre><p>&nbsp;</p>
]]></content:encoded>
					
					<wfw:commentRss>https://tutorialspage.com/php-logical-operators-true-false/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">940</post-id>	</item>
	</channel>
</rss>
