<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Martin Jirasek</title>
    <description>The latest articles on Forem by Martin Jirasek (@sirzarganwar).</description>
    <link>https://forem.com/sirzarganwar</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F297594%2F4d38cb94-cdb3-40c8-ade5-e17a60c0c0bd.jpg</url>
      <title>Forem: Martin Jirasek</title>
      <link>https://forem.com/sirzarganwar</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/sirzarganwar"/>
    <language>en</language>
    <item>
      <title>A Simple Trick to Organize Your PHP Collections Effectively</title>
      <dc:creator>Martin Jirasek</dc:creator>
      <pubDate>Wed, 03 Dec 2025 11:08:26 +0000</pubDate>
      <link>https://forem.com/sirzarganwar/a-simple-trick-to-organize-your-php-collections-effectively-4e6n</link>
      <guid>https://forem.com/sirzarganwar/a-simple-trick-to-organize-your-php-collections-effectively-4e6n</guid>
      <description>&lt;p&gt;This is our Bag class — and yes, we absolutely love its simplicity 🥰&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Bag&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;__construct&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="kt"&gt;array&lt;/span&gt; &lt;span class="nv"&gt;$items&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[])&lt;/span&gt; &lt;span class="p"&gt;{}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;HOW TO WORK WITH IT?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The long way (a.k.a. “why make it simple?”)&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Create collection objects&lt;/li&gt;
&lt;li&gt;Insert them into another collection&lt;/li&gt;
&lt;li&gt;Fill them with items
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nv"&gt;$bagA&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Bag&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="nv"&gt;$bagB&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Bag&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

&lt;span class="nv"&gt;$preparedObjects&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[];&lt;/span&gt;
&lt;span class="nv"&gt;$preparedObjects&lt;/span&gt;&lt;span class="p"&gt;[]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;$bagA&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nv"&gt;$preparedObjects&lt;/span&gt;&lt;span class="p"&gt;[]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;$bagB&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nv"&gt;$bagA&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;items&lt;/span&gt;&lt;span class="p"&gt;[]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'Bag A item 1'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nv"&gt;$bagA&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;items&lt;/span&gt;&lt;span class="p"&gt;[]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'Bag A item 2'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nv"&gt;$bagB&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;items&lt;/span&gt;&lt;span class="p"&gt;[]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'Bag B item 1'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nv"&gt;$bagB&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;items&lt;/span&gt;&lt;span class="p"&gt;[]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'Bag B item 2'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;The simpler way (clean, elegant, instant 😌)&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Create and insert objects right away&lt;/li&gt;
&lt;li&gt;Then just fill them
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nv"&gt;$preparedObjects&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="nv"&gt;$bagA&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Bag&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
    &lt;span class="nv"&gt;$bagB&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Bag&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
&lt;span class="p"&gt;];&lt;/span&gt;

&lt;span class="nv"&gt;$bagA&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;items&lt;/span&gt;&lt;span class="p"&gt;[]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'Bag A item 1'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nv"&gt;$bagA&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;items&lt;/span&gt;&lt;span class="p"&gt;[]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'Bag A item 2'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nv"&gt;$bagB&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;items&lt;/span&gt;&lt;span class="p"&gt;[]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'Bag B item 1'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nv"&gt;$bagB&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;items&lt;/span&gt;&lt;span class="p"&gt;[]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'Bag B item 2'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>php</category>
      <category>programming</category>
    </item>
    <item>
      <title>🎯 When Failure Isn’t Final: Meet failure-retry-executor</title>
      <dc:creator>Martin Jirasek</dc:creator>
      <pubDate>Tue, 30 Sep 2025 07:55:22 +0000</pubDate>
      <link>https://forem.com/sirzarganwar/when-failure-isnt-final-meet-failure-retry-executor-5cic</link>
      <guid>https://forem.com/sirzarganwar/when-failure-isnt-final-meet-failure-retry-executor-5cic</guid>
      <description>&lt;p&gt;Imagine a world where a function fails — and you can just send it back into action, no whining, no reinventing the wheel. That’s exactly what &lt;strong&gt;failure-retry-executor&lt;/strong&gt; does: it retries your command until you tell it “okay, stop that” (default max attempts: 3). &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;a href="https://github.com/Zarganwar/failure-retry-executor" rel="noopener noreferrer"&gt;Zarganwar/failure-retry-executor&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;How it works?&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You wrap your risky command in &lt;code&gt;execute(fn() =&amp;gt; …)&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;If something goes wrong (an exception, or a &lt;code&gt;false&lt;/code&gt;return), the executor picks itself up, blinks, and tries again.&lt;/li&gt;
&lt;li&gt;If it succeeds — &lt;em&gt;voilà!&lt;/em&gt; — your &lt;code&gt;onSuccess&lt;/code&gt;callback runs.&lt;/li&gt;
&lt;li&gt;If all tries fail? The &lt;code&gt;onFailure&lt;/code&gt;callback gets fired — perfect moment for logging, cursing softly, or both.&lt;/li&gt;
&lt;li&gt;And yes — you can configure how many retries you want.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Where it shines&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;When talking to flaky external APIs that sometimes just decide they’re having a bad day.&lt;/li&gt;
&lt;li&gt;In operations where occasional failure isn’t the end of the world — it’s just part of the dance.&lt;/li&gt;
&lt;li&gt;When you want a clean retry mechanism instead of a tangled while &lt;code&gt;(retries--) { … }&lt;/code&gt; mess.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;An example for inspiration&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nc"&gt;Zarganwar\FailureRetryExecutor\FailureRetryExecutor&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;execute&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;command&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="k"&gt;fn&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nv"&gt;$client&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'https://api.example.com/data'&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="n"&gt;maxAttempts&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;onSuccess&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="k"&gt;fn&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$response&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Hooray, we got the data!"&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="n"&gt;onFailure&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="k"&gt;fn&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;Throwable&lt;/span&gt; &lt;span class="nv"&gt;$e&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;error_log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Ugh, still failing: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nv"&gt;$e&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;getMessage&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;In closing&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Failure is not the end — it’s just a nudge to try again. And if it doesn’t work even after three (or five) tries, at least you’ve got an elegant way to shut it down gracefully. 😄&lt;br&gt;
If you like clean, simple, clever solutions, give &lt;em&gt;failure-retry-executor a spin&lt;/em&gt;.&lt;/p&gt;




&lt;p&gt;Just try it 🤗&lt;br&gt;
&lt;a href="https://github.com/Zarganwar/failure-retry-executor" rel="noopener noreferrer"&gt;Zarganwar/failure-retry-executor&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;👋&lt;/p&gt;

</description>
      <category>php</category>
      <category>programming</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Human readable big numbers in PHP</title>
      <dc:creator>Martin Jirasek</dc:creator>
      <pubDate>Tue, 20 May 2025 13:02:37 +0000</pubDate>
      <link>https://forem.com/sirzarganwar/unreadable-large-numbers-in-php-2b61</link>
      <guid>https://forem.com/sirzarganwar/unreadable-large-numbers-in-php-2b61</guid>
      <description>&lt;p&gt;You’ve probably encountered situations where you need to write out a large number, and the longer it gets, the harder it is to tell how many digits it actually has. Is 130000000 equal to 13 million, 130 million, or 1.3 billion? At first glance, it’s a mess.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nv"&gt;$number&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;130000000&lt;/span&gt;    &lt;span class="c1"&gt;// This number is 😐?&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;One alternative is to use exponential notation, which makes the magnitude clear:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nv"&gt;$number&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;130&lt;/span&gt;&lt;span class="n"&gt;e6&lt;/span&gt;    &lt;span class="c1"&gt;// immediately obvious: 130 million 🤘&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;But for numbers like 133456115, writing it as 133.456115e6 starts to feel counterproductive.&lt;/p&gt;

&lt;p&gt;Starting with PHP 7.4, there’s a handy new syntax: the numeric literal separator. You can sprinkle underscores into your numbers to improve readability, just like you would in a miliseconds or any other long number that you want to ready clearly:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nv"&gt;$number&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;130_000_000&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;    &lt;span class="c1"&gt;// 🤩 WOW, that’s clearly 130 million!&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The underscores don’t change the value or the type:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nb"&gt;var_dump&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;130_000_000&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="mi"&gt;130000000&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;     &lt;span class="c1"&gt;// true  (integer === integer)&lt;/span&gt;
&lt;span class="nb"&gt;var_dump&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mf"&gt;130_000_000.000&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="mi"&gt;130000000&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// false (float   !== integer)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;See the RFC for more details:&lt;br&gt;
&lt;a href="https://wiki.php.net/rfc/numeric_literal_separator" rel="noopener noreferrer"&gt;PHP RFC&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;PS: JavaScript supports a similar feature!&lt;/p&gt;

</description>
      <category>php</category>
      <category>programming</category>
      <category>productivity</category>
      <category>learning</category>
    </item>
    <item>
      <title>PHP in Docker container for begginers as simple as possible 🎈</title>
      <dc:creator>Martin Jirasek</dc:creator>
      <pubDate>Thu, 09 Jan 2025 09:49:50 +0000</pubDate>
      <link>https://forem.com/sirzarganwar/docker-for-php-begginers-as-simple-as-possible-4ehj</link>
      <guid>https://forem.com/sirzarganwar/docker-for-php-begginers-as-simple-as-possible-4ehj</guid>
      <description>&lt;p&gt;I would like to target this article at &lt;strong&gt;beginners&lt;/strong&gt; because I haven’t been able to find a proper article about a simple container for PHP. I want to give a heads-up to nitpickers in advance that I’m focusing only on the simplest approach.&lt;br&gt;
Please note that I am working on Windows, but aside from a few minor details, the process is the same on macOS or Linux.&lt;/p&gt;




&lt;p&gt;The premise is to have Docker installed. I won’t cover this in the article, as it depends on your operating system. However, it’s not too complicated.  &lt;/p&gt;

&lt;p&gt;Additionally, I have one recommendation for Windows users: use WSL2. The instructions are available &lt;a href="https://learn.microsoft.com/en-us/windows/wsl/install" rel="noopener noreferrer"&gt;Microsoft: How to install Linux on Windows with WSL&lt;/a&gt;, and based on my experience, installation is just a matter of following a few commands from the page. If you carefully follow the steps one by one, you’ll get it done successfully.&lt;/p&gt;




&lt;h2&gt;
  
  
  If everything is ready, we can dive in.
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Start Docker&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;Icon that indicates whether the Docker is running
&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fs2txn3emivn1zh0ro5q5.png" alt="Image description" width="617" height="154"&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Launch your favorite PHP editor/IDE&lt;/strong&gt; 
– I'm using IntelliJ PHPStorm&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Create a new project. I place project into Ubuntu directories&lt;/strong&gt; (see the WSL2 installation above)

&lt;ul&gt;
&lt;li&gt;I created mine in the following directory: &lt;code&gt;\\wsl.localhost\Ubuntu\home\development\docker-php-simple&lt;/code&gt;
&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F622tqvyd4fata27n4xm4.png" alt="Image description" width="358" height="227"&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;In the project directory, create the following files and folder structure&lt;/strong&gt;
&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsmhgfs5d6qjfxqqdqjg9.png" alt="Image description" width="424" height="228"&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Now, let's add content to these three files:&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;public/index.php&lt;/code&gt;&lt;/strong&gt;: Prepare a nice piece of code that welcomes you :-)
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="cp"&gt;&amp;lt;?php&lt;/span&gt;

&lt;span class="k"&gt;echo&lt;/span&gt; &lt;span class="s1"&gt;'Hello, Developer!'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;.docker/apache/sites-available/000-default.conf&lt;/code&gt;&lt;/strong&gt;: A simple configuration that specifies the default directory of our website
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight apache"&gt;&lt;code&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nl"&gt;VirtualHost&lt;/span&gt;&lt;span class="sr"&gt; *:80&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;
&lt;/span&gt;    &lt;span class="nc"&gt;DocumentRoot&lt;/span&gt; "/var/www/html/public"
&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nl"&gt;VirtualHost&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;docker-compose.yml&lt;/code&gt;&lt;/strong&gt;: Configuration settings for the Docker containers
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;services&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;app&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;image&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;php:8.4-apache&lt;/span&gt;
    &lt;span class="na"&gt;container_name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;docker-php-simple&lt;/span&gt;
    &lt;span class="na"&gt;tty&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
    &lt;span class="na"&gt;volumes&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="c1"&gt;# Mount the current directory to the /var/www/html directory in the container&lt;/span&gt;
      &lt;span class="c1"&gt;# It means that the files in the current directory (./) will be available in the container at /var/www/html&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;./:/var/www/html&lt;/span&gt;
      &lt;span class="c1"&gt;# Apache configuration file for the virtual host&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;./.docker/apache/sites-available/000-default.conf:/etc/apache2/sites-available/000-default.conf&lt;/span&gt;
&lt;span class="c1"&gt;#    working_dir: /var/www/html&lt;/span&gt;
    &lt;span class="na"&gt;ports&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="c1"&gt;# Your web server will be available at http://localhost:8080&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;8080:80"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Let's get it running!
&lt;/h2&gt;

&lt;p&gt;Follow these steps based on your preferred method:&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Option 1: Using the Docker Plugin in Your Editor&lt;/strong&gt;
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Open the &lt;code&gt;docker-compose.yml&lt;/code&gt; file in your editor.
&lt;/li&gt;
&lt;li&gt;Look for the &lt;strong&gt;double arrows&lt;/strong&gt; (in PHPStorm) (▶︎▶︎) in the interface and click them. &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpv9tmru1smd29ur5czxh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpv9tmru1smd29ur5czxh.png" alt="Image description" width="332" height="120"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This will start your Docker containers. The starting process and result is visible in IDE's console.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fitqlbt15ntkdjomz1dzu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fitqlbt15ntkdjomz1dzu.png" alt="Image description" width="684" height="144"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Option 2: Using a Terminal&lt;/strong&gt;
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Open your terminal (e.g., Git Bash, Command Prompt, or any terminal you prefer).
&lt;/li&gt;
&lt;li&gt;Navigate to your project directory&lt;/li&gt;
&lt;li&gt;Run the following command to start the containers:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   docker-compose up &lt;span class="nt"&gt;-d&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once the containers are up, your application should be running.&lt;/p&gt;

&lt;p&gt;You can open the Docker application, and you should see a running container with your application, named &lt;strong&gt;&lt;code&gt;docker-php-simple&lt;/code&gt;&lt;/strong&gt;. &lt;/p&gt;

&lt;p&gt;If everything is set up correctly, the container should have a "Running" status, and you can manage it directly from the Docker dashboard, such as stopping, restarting, or inspecting logs if needed. 🎉&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fijbbvfu4onw4g7teuqe6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fijbbvfu4onw4g7teuqe6.png" alt="Image description" width="800" height="377"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  And as the grand finale, here is our application in action! 🎉
&lt;/h2&gt;

&lt;p&gt;Check it in your browser by accessing the appropriate URL &lt;code&gt;http://localhost:8080/&lt;/code&gt;. 🚀&lt;/p&gt;

&lt;p&gt;You should see your welcome message &lt;strong&gt;Hello, Developer!&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>php</category>
      <category>beginners</category>
      <category>docker</category>
    </item>
    <item>
      <title>Automate Symfony EventSubscriberInterface::getSubscribedEvents()</title>
      <dc:creator>Martin Jirasek</dc:creator>
      <pubDate>Mon, 25 Nov 2024 13:39:37 +0000</pubDate>
      <link>https://forem.com/sirzarganwar/automate-symfonycomponenteventdispatchereventsubscriberinterfacegetsubscribedevents-with-160</link>
      <guid>https://forem.com/sirzarganwar/automate-symfonycomponenteventdispatchereventsubscriberinterfacegetsubscribedevents-with-160</guid>
      <description>&lt;p&gt;Do you like &lt;strong&gt;Symfony\Component\EventDispatcher\EventSubscriberInterface&lt;/strong&gt; and it's getSubscribedEvents() method?&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;AwesomeSubscriber&lt;/span&gt; &lt;span class="kd"&gt;implements&lt;/span&gt; &lt;span class="nc"&gt;Symfony\Component\EventDispatcher\EventSubscriberInterface&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;

    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;static&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;getSubscribedEvents&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt; &lt;span class="kt"&gt;array&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
            &lt;span class="nc"&gt;HappyEvent&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;class&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'happy'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="nc"&gt;CoolEvent&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;class&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'cool'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="p"&gt;];&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;happy&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;HappyEvent&lt;/span&gt; &lt;span class="nv"&gt;$event&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="p"&gt;{}&lt;/span&gt;

    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;cool&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;CoolEvent&lt;/span&gt; &lt;span class="nv"&gt;$event&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="p"&gt;{}&lt;/span&gt;

&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;I hate it!&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Array with textual method name representation&lt;/li&gt;
&lt;li&gt;Event class-name written multiple times 😑&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Yes, new Symfony has attribute &lt;em&gt;#[AsEventListener]&lt;/em&gt;, but what if you use another framework or older version of event-dispatcher or you don't like attributes?&lt;/p&gt;

&lt;p&gt;There is simple solution 💥&lt;br&gt;
See this trait &lt;a href="https://github.com/Zarganwar/symfony-event-dispatcher-utils" rel="noopener noreferrer"&gt;https://github.com/Zarganwar/symfony-event-dispatcher-utils&lt;/a&gt;.&lt;br&gt;
That provides you with a simple (automatic) way to subscribe to events to __invoke method.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;AwesomeSubscriber&lt;/span&gt; &lt;span class="kd"&gt;implements&lt;/span&gt; &lt;span class="nc"&gt;Symfony\Component\EventDispatcher\EventSubscriberInterface&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kn"&gt;use&lt;/span&gt; &lt;span class="nc"&gt;AutoEventSubscriberTrait&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// &amp;lt;&amp;lt;&amp;lt;--- This is it! ❤️&lt;/span&gt;

    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;__invoke&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;HappyEvent&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="nc"&gt;CoolEvent&lt;/span&gt; &lt;span class="nv"&gt;$event&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="p"&gt;{}&lt;/span&gt;

&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;or subscriber per event&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;HappySubscriber&lt;/span&gt; &lt;span class="kd"&gt;implements&lt;/span&gt; &lt;span class="nc"&gt;Symfony\Component\EventDispatcher\EventSubscriberInterface&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kn"&gt;use&lt;/span&gt; &lt;span class="nc"&gt;AutoEventSubscriberTrait&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;__invoke&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;HappyEvent&lt;/span&gt; &lt;span class="nv"&gt;$event&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="p"&gt;{}&lt;/span&gt;

&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;CoolSubscriber&lt;/span&gt; &lt;span class="kd"&gt;implements&lt;/span&gt; &lt;span class="nc"&gt;Symfony\Component\EventDispatcher\EventSubscriberInterface&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kn"&gt;use&lt;/span&gt; &lt;span class="nc"&gt;AutoEventSubscriberTrait&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;__invoke&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;CoolEvent&lt;/span&gt; &lt;span class="nv"&gt;$event&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="p"&gt;{}&lt;/span&gt;

&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Of course, you can use interfaces and union types.&lt;/p&gt;

&lt;p&gt;Go to &lt;a href="https://github.com/Zarganwar/symfony-event-dispatcher-utils" rel="noopener noreferrer"&gt;https://github.com/Zarganwar/symfony-event-dispatcher-utils&lt;/a&gt; and install&lt;/p&gt;

&lt;p&gt;&lt;code&gt;composer require zarganwar/symfony-event-dispatcher-utils&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Enjoy! 🎉&lt;/p&gt;

</description>
      <category>symfony</category>
      <category>php</category>
    </item>
    <item>
      <title>PHP snippet #008</title>
      <dc:creator>Martin Jirasek</dc:creator>
      <pubDate>Wed, 31 May 2023 09:01:57 +0000</pubDate>
      <link>https://forem.com/sirzarganwar/php-snippet-007-9pf</link>
      <guid>https://forem.com/sirzarganwar/php-snippet-007-9pf</guid>
      <description>&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Hello types and keywords
echo (bool)+(null)+(int)+(float)+(string)+(double)+(null)+(false)+(true)+(bool)(array)(exit);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>php</category>
      <category>programming</category>
    </item>
    <item>
      <title>PHP snippet #007</title>
      <dc:creator>Martin Jirasek</dc:creator>
      <pubDate>Tue, 30 Nov 2021 12:21:23 +0000</pubDate>
      <link>https://forem.com/sirzarganwar/php-snippet-007-36d</link>
      <guid>https://forem.com/sirzarganwar/php-snippet-007-36d</guid>
      <description>&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nv"&gt;$stairs&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[];&lt;/span&gt;

&lt;span class="nv"&gt;$stairs&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'_'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'👾'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nv"&gt;$stairs&lt;/span&gt;&lt;span class="p"&gt;[][&lt;/span&gt;&lt;span class="s1"&gt;'_'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'👽'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nv"&gt;$stairs&lt;/span&gt;&lt;span class="p"&gt;[][][&lt;/span&gt;&lt;span class="s1"&gt;'_'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'🤢'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nv"&gt;$stairs&lt;/span&gt;&lt;span class="p"&gt;[][][][&lt;/span&gt;&lt;span class="s1"&gt;'_'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'🥴'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nv"&gt;$stairs&lt;/span&gt;&lt;span class="p"&gt;[][][][][&lt;/span&gt;&lt;span class="s1"&gt;'_'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'😓'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nv"&gt;$stairs&lt;/span&gt;&lt;span class="p"&gt;[][][][][][&lt;/span&gt;&lt;span class="s1"&gt;'_'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'😑'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nv"&gt;$stairs&lt;/span&gt;&lt;span class="p"&gt;[][][][][][][&lt;/span&gt;&lt;span class="s1"&gt;'_'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'😗'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nv"&gt;$stairs&lt;/span&gt;&lt;span class="p"&gt;[][][][][][][][&lt;/span&gt;&lt;span class="s1"&gt;'_'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'😎'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>php</category>
      <category>programming</category>
    </item>
    <item>
      <title>PHP snippet #006</title>
      <dc:creator>Martin Jirasek</dc:creator>
      <pubDate>Mon, 02 Aug 2021 07:59:42 +0000</pubDate>
      <link>https://forem.com/sirzarganwar/php-snippet-006-12nj</link>
      <guid>https://forem.com/sirzarganwar/php-snippet-006-12nj</guid>
      <description>&lt;p&gt;If you are very hungry and fridge is totally empty!&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;PHP Notice: Undefined index: FOOD in /mnt/data/html/public/index.php:314
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>php</category>
    </item>
    <item>
      <title>PHP snippet #005</title>
      <dc:creator>Martin Jirasek</dc:creator>
      <pubDate>Wed, 23 Sep 2020 13:29:05 +0000</pubDate>
      <link>https://forem.com/sirzarganwar/php-snippet-005-3lno</link>
      <guid>https://forem.com/sirzarganwar/php-snippet-005-3lno</guid>
      <description>&lt;p&gt;$💲 = '💲';&lt;/p&gt;

</description>
      <category>php</category>
    </item>
    <item>
      <title>PHP snippet #004</title>
      <dc:creator>Martin Jirasek</dc:creator>
      <pubDate>Tue, 21 Apr 2020 08:51:58 +0000</pubDate>
      <link>https://forem.com/sirzarganwar/php-snippet-004-1245</link>
      <guid>https://forem.com/sirzarganwar/php-snippet-004-1245</guid>
      <description>&lt;p&gt;From funny chat 🚀&lt;/p&gt;

&lt;p&gt;A:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    5--; // Is 4
    5++; // Is 6
    then 5**; // Is 25?
    And 5//; // Should be 1 but it's comment
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;B:&lt;br&gt;
5** is fast comet with weight 5&lt;br&gt;
5*** is faster&lt;/p&gt;

</description>
      <category>php</category>
    </item>
    <item>
      <title>PHP snippet #003</title>
      <dc:creator>Martin Jirasek</dc:creator>
      <pubDate>Mon, 20 Jan 2020 15:02:19 +0000</pubDate>
      <link>https://forem.com/sirzarganwar/php-snippet-003-4o7b</link>
      <guid>https://forem.com/sirzarganwar/php-snippet-003-4o7b</guid>
      <description>&lt;div class="highlight"&gt;&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Current Thai year&lt;/span&gt;
&lt;span class="k"&gt;echo&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="nb"&gt;date&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'Y'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;543&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



</description>
      <category>php</category>
    </item>
    <item>
      <title>PHP snippet #002</title>
      <dc:creator>Martin Jirasek</dc:creator>
      <pubDate>Thu, 02 Jan 2020 08:52:38 +0000</pubDate>
      <link>https://forem.com/sirzarganwar/php-snippet-002-3jg5</link>
      <guid>https://forem.com/sirzarganwar/php-snippet-002-3jg5</guid>
      <description>&lt;div class="highlight"&gt;&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Ping pong&lt;/span&gt;
&lt;span class="nx"&gt;player_01&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;echo&lt;/span&gt; &lt;span class="s1"&gt;'click '&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;goto&lt;/span&gt; &lt;span class="nx"&gt;player_02&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nx"&gt;player_02&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;echo&lt;/span&gt; &lt;span class="s1"&gt;'clack '&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;goto&lt;/span&gt; &lt;span class="nx"&gt;player_01&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



</description>
      <category>php</category>
    </item>
  </channel>
</rss>
