<?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: Patricia Hernandez</title>
    <description>The latest articles on Forem by Patricia Hernandez (@patricia1988hernandez2).</description>
    <link>https://forem.com/patricia1988hernandez2</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%2F883690%2Ffa305af5-79f7-4da1-8849-36b0031a50f5.jpg</url>
      <title>Forem: Patricia Hernandez</title>
      <link>https://forem.com/patricia1988hernandez2</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/patricia1988hernandez2"/>
    <language>en</language>
    <item>
      <title>Create a Dynamic List with JavaScript</title>
      <dc:creator>Patricia Hernandez</dc:creator>
      <pubDate>Fri, 16 May 2025 08:36:07 +0000</pubDate>
      <link>https://forem.com/patricia1988hernandez2/create-a-dynamic-list-with-javascript-2ohe</link>
      <guid>https://forem.com/patricia1988hernandez2/create-a-dynamic-list-with-javascript-2ohe</guid>
      <description>&lt;p&gt;In this tutorial, you'll learn how to build a dynamic list using HTML, CSS, and JavaScript. You can add new items with a title and note, and delete any item with a single click. This project is great for beginners who want to practice DOM manipulation.&lt;/p&gt;

&lt;p&gt;You’ll create a simple form that lets users:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Add a note with a title and message&lt;/li&gt;
&lt;li&gt;View all added notes&lt;/li&gt;
&lt;li&gt;Delete any note
Let’s break it down step by step.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  How to Build a Dynamic List with JavaScript
&lt;/h2&gt;

&lt;p&gt;Building a dynamic list in JavaScript is a great way to learn how web pages respond to user actions without reloading. &lt;/p&gt;

&lt;p&gt;This project uses HTML for structure, CSS for styling, and JavaScript to control the behavior. The main idea is to let users add and remove items from a list directly on the page.&lt;/p&gt;

&lt;h3&gt;
  
  
  Setting Up the Structure
&lt;/h3&gt;

&lt;p&gt;First, the page has a simple form with two fields: one for the title and another for the note. &lt;/p&gt;

&lt;p&gt;When users type their content and submit the form, JavaScript reads the values and checks if both fields are filled. If the form is valid, it creates a new card showing the title and note.&lt;/p&gt;

&lt;h3&gt;
  
  
  Updating the Note Counter
&lt;/h3&gt;

&lt;p&gt;Each card appears in a section below the form. JavaScript updates this section in real time. &lt;/p&gt;

&lt;p&gt;The script also keeps track of how many notes have been added by increasing a counter every time a new item is created. This counter is visible on the page and updates automatically without refreshing.&lt;/p&gt;

&lt;h3&gt;
  
  
  Removing Notes from the List
&lt;/h3&gt;

&lt;p&gt;A delete link appears at the top corner of each card. When clicked, JavaScript removes the selected card from the list. It also decreases the counter, keeping the note count accurate. &lt;/p&gt;

&lt;p&gt;This deletion happens instantly, giving the user immediate feedback.&lt;/p&gt;

&lt;p&gt;This project shows how JavaScript can interact with HTML elements, handle events like button clicks, and update content on the page without needing a server. &lt;/p&gt;

&lt;p&gt;It’s a hands-on way to practice working with the DOM, or Document Object Model, which represents all the elements in a web page.&lt;/p&gt;

&lt;p&gt;If you want to go further, you can add more features like saving notes in the browser’s local storage, adding timestamps, or editing existing items. &lt;/p&gt;

&lt;p&gt;But even in its basic form, this project teaches the core idea behind interactive web apps: user actions trigger changes on the page, and JavaScript makes it all happen in the background.&lt;/p&gt;

&lt;p&gt;You can follow the code in &lt;a href="https://codesandbox.io/p/sandbox/vd63zm" rel="noopener noreferrer"&gt;SandBox&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Wrapping Up
&lt;/h2&gt;

&lt;p&gt;This project shows how you can use JavaScript to build interactive features without complex tools or frameworks. &lt;/p&gt;

&lt;p&gt;You created a form, added dynamic content, updated a counter, and handled delete actions—all using plain JavaScript. &lt;/p&gt;

&lt;p&gt;These are the building blocks of many real-world web applications. If you're just starting out, this kind of hands-on practice will help you understand how the browser works and how to make your pages respond to users. Keep experimenting and try adding new features as you learn more.&lt;/p&gt;

</description>
      <category>programming</category>
      <category>javascript</category>
      <category>beginners</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Create JavaScript Dynamic List (Step-by-Step Guide)</title>
      <dc:creator>Patricia Hernandez</dc:creator>
      <pubDate>Tue, 13 May 2025 20:54:49 +0000</pubDate>
      <link>https://forem.com/patricia1988hernandez2/create-javascript-dynamic-list-step-by-step-guide-3465</link>
      <guid>https://forem.com/patricia1988hernandez2/create-javascript-dynamic-list-step-by-step-guide-3465</guid>
      <description>&lt;p&gt;A dynamic list updates based on user actions like adding, removing, or editing items. In this tutorial, you'll learn how to create a dynamic list using HTML, CSS, and JavaScript.&lt;/p&gt;

&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Basic knowledge of HTML, CSS, and JavaScript&lt;/li&gt;
&lt;li&gt;A code editor (like VS Code)&lt;/li&gt;
&lt;li&gt;A browser for testing&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Set Up HTML Structure
&lt;/h2&gt;

&lt;p&gt;Create a basic HTML file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html&amp;gt;
&amp;lt;head&amp;gt;
  &amp;lt;title&amp;gt;Dynamic List&amp;lt;/title&amp;gt;
  &amp;lt;style&amp;gt;
    ul {
      padding-left: 20px;
    }
    li {
      margin-bottom: 5px;
    }
    button {
      margin-left: 10px;
    }
  &amp;lt;/style&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
  &amp;lt;h2&amp;gt;Dynamic List&amp;lt;/h2&amp;gt;
  &amp;lt;input type="text" id="itemInput" placeholder="Enter item"&amp;gt;
  &amp;lt;button onclick="addItem()"&amp;gt;Add&amp;lt;/button&amp;gt;

  &amp;lt;ul id="itemList"&amp;gt;&amp;lt;/ul&amp;gt;

  &amp;lt;script src="script.js"&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;

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

&lt;/div&gt;



&lt;h2&gt;
  
  
  Write JavaScript Logic
&lt;/h2&gt;

&lt;p&gt;Create a file named script.js and add the following code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function addItem() {
  const input = document.getElementById('itemInput');
  const value = input.value.trim();

  if (value === '') return;

  const li = document.createElement('li');
  li.textContent = value;

  const removeBtn = document.createElement('button');
  removeBtn.textContent = 'Remove';
  removeBtn.onclick = function () {
    li.remove();
  };

  li.appendChild(removeBtn);
  document.getElementById('itemList').appendChild(li);

  input.value = '';
  input.focus();
}

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

&lt;/div&gt;



&lt;p&gt;How It Works?&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The user types a value in the input field.&lt;/li&gt;
&lt;li&gt;When the Add button is clicked, addItem() runs.&lt;/li&gt;
&lt;li&gt;It creates a new &lt;/li&gt;
&lt;li&gt; with the input text and a "Remove" button.&lt;/li&gt;
&lt;li&gt;Clicking "Remove" deletes that item.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Here is the &lt;a href="https://jsfiddle.net/ro21vfwd/12/" rel="noopener noreferrer"&gt;full example in JSFiddle&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;You now have a simple dynamic list using JavaScript. You can improve it by saving items to localStorage, adding edit buttons, or using frameworks like React for complex UIs.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>beginners</category>
      <category>javascript</category>
    </item>
    <item>
      <title>How to Learn PHP: A Practical Guide</title>
      <dc:creator>Patricia Hernandez</dc:creator>
      <pubDate>Mon, 05 May 2025 20:42:20 +0000</pubDate>
      <link>https://forem.com/patricia1988hernandez2/how-to-learn-php-a-practical-guide-p4d</link>
      <guid>https://forem.com/patricia1988hernandez2/how-to-learn-php-a-practical-guide-p4d</guid>
      <description>&lt;p&gt;PHP is a server-side scripting language used to build dynamic websites and web applications. It's easy to get started, and learning it can open doors to backend development. This guide walks you through the most effective way to learn PHP from scratch.&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%2F9npon13silvi8yae1e6f.jpg" 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%2F9npon13silvi8yae1e6f.jpg" alt="Image description" width="512" height="279"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Understand What PHP Does
&lt;/h2&gt;

&lt;p&gt;Before diving in, know what PHP is for:&lt;/p&gt;

&lt;p&gt;Runs on the server to generate HTML&lt;/p&gt;

&lt;p&gt;Connects to databases like MySQL&lt;/p&gt;

&lt;p&gt;Handles form submissions, sessions, and authentication&lt;/p&gt;

&lt;p&gt;You’ll often use PHP alongside HTML, CSS, JavaScript, and SQL.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Set Up Your Environment
&lt;/h2&gt;

&lt;p&gt;Install the tools you need:&lt;/p&gt;

&lt;p&gt;Local server: Use XAMPP, MAMP, or Laragon. These bundles include Apache, PHP, and MySQL.&lt;/p&gt;

&lt;p&gt;Code editor: Use VS Code, Sublime Text, or PHPStorm.&lt;/p&gt;

&lt;p&gt;Browser: Chrome or Firefox for testing your output.&lt;/p&gt;

&lt;p&gt;Once installed, place your PHP files in the correct web directory (usually htdocs/ for XAMPP).&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Learn the Basics
&lt;/h2&gt;

&lt;p&gt;Start with PHP syntax:&lt;/p&gt;

&lt;p&gt;Variables and data types ($name, $age, etc.)&lt;/p&gt;

&lt;p&gt;Operators (+, ===, &amp;amp;&amp;amp;)&lt;/p&gt;

&lt;p&gt;Control structures (if, else, switch)&lt;/p&gt;

&lt;p&gt;Loops (for, while, foreach)&lt;/p&gt;

&lt;p&gt;Functions (function greet() {})&lt;/p&gt;

&lt;p&gt;Write small scripts to test each concept.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Work with Forms and User Input
&lt;/h2&gt;

&lt;p&gt;Learn how PHP handles HTML forms:&lt;/p&gt;

&lt;p&gt;Use $_POST and $_GET to retrieve data&lt;/p&gt;

&lt;p&gt;Validate and sanitize input using filter_var()&lt;/p&gt;

&lt;p&gt;Practice creating login forms and contact forms&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Use PHP with a Database
&lt;/h2&gt;

&lt;p&gt;Connect PHP to MySQL:&lt;/p&gt;

&lt;p&gt;Use mysqli or PDO to run queries&lt;/p&gt;

&lt;p&gt;Create tables, insert data, fetch results&lt;/p&gt;

&lt;p&gt;Build a simple app like a to-do list or blog&lt;/p&gt;

&lt;h2&gt;
  
  
  6. Practice with Projects
&lt;/h2&gt;

&lt;p&gt;Apply what you’ve learned. Build small projects such as:&lt;/p&gt;

&lt;p&gt;A guestbook&lt;/p&gt;

&lt;p&gt;A login system&lt;/p&gt;

&lt;p&gt;A simple content management system (CMS)&lt;/p&gt;

&lt;p&gt;Projects help you spot gaps in your knowledge and build confidence.&lt;/p&gt;

&lt;h2&gt;
  
  
  7. Learn About Security
&lt;/h2&gt;

&lt;p&gt;Don’t ignore security. Study:&lt;/p&gt;

&lt;p&gt;Input validation and sanitization&lt;/p&gt;

&lt;p&gt;SQL injection prevention&lt;/p&gt;

&lt;p&gt;Session handling and CSRF protection&lt;/p&gt;

&lt;p&gt;Password hashing with password_hash()&lt;/p&gt;

&lt;h2&gt;
  
  
  8. Explore Advanced Topics
&lt;/h2&gt;

&lt;p&gt;Once you're comfortable with the basics:&lt;/p&gt;

&lt;p&gt;Learn object-oriented PHP (classes, objects, inheritance)&lt;/p&gt;

&lt;p&gt;Study PHP 8+ features (nullsafe operator, named arguments)&lt;/p&gt;

&lt;p&gt;Try a PHP framework like Laravel&lt;/p&gt;

&lt;h2&gt;
  
  
  9. Use Official Resources
&lt;/h2&gt;

&lt;p&gt;PHP Manual&lt;/p&gt;

&lt;p&gt;W3Schools PHP Tutorial&lt;/p&gt;

&lt;p&gt;PHP: The Right Way&lt;/p&gt;

&lt;p&gt;&lt;a href="https://sites.google.com/view/write-coding/home" rel="noopener noreferrer"&gt;These sites offer solid references and examples&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  10. Keep Practicing
&lt;/h2&gt;

&lt;p&gt;The best way to learn is by doing. Join online forums, contribute to projects, or freelance small PHP jobs. The more you build, the more you’ll learn.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>beginners</category>
      <category>php</category>
    </item>
    <item>
      <title>Abstract Classes in PHP: What They Are and How to Use Them</title>
      <dc:creator>Patricia Hernandez</dc:creator>
      <pubDate>Tue, 22 Apr 2025 16:54:21 +0000</pubDate>
      <link>https://forem.com/patricia1988hernandez2/abstract-classes-in-php-what-they-are-and-how-to-use-them-20cp</link>
      <guid>https://forem.com/patricia1988hernandez2/abstract-classes-in-php-what-they-are-and-how-to-use-them-20cp</guid>
      <description>&lt;p&gt;PHP abstract classes help you define a base class that other classes must follow. They act like a blueprint. You can't create an object from an abstract class directly. But you can extend it and use its structure.&lt;/p&gt;

&lt;h3&gt;
  
  
  What Is an Abstract Class?
&lt;/h3&gt;

&lt;p&gt;An &lt;a href="https://dev.to/montasser/understand-how-the-abstract-class-works-in-php-5bff"&gt;abstract class&lt;/a&gt; contains abstract methods. These are methods declared but not fully defined. Child classes must define them.&lt;/p&gt;

&lt;p&gt;You use the &lt;code&gt;abstract&lt;/code&gt; keyword to define both abstract classes and abstract methods.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why Use Abstract Classes?
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Force child classes to follow a structure&lt;/li&gt;
&lt;li&gt;Share common code across related classes&lt;/li&gt;
&lt;li&gt;Build a reusable foundation&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Let’s explore abstract classes with silly but clear examples.&lt;/p&gt;

&lt;h2&gt;
  
  
  Example 1: Abstract Class &lt;code&gt;Boy&lt;/code&gt;
&lt;/h2&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;abstract&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Boy&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="nv"&gt;$name&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="nv"&gt;$name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nv"&gt;$this&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;$name&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="k"&gt;abstract&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;play&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;sayHello&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"Hi, I'm &lt;/span&gt;&lt;span class="nv"&gt;$this-&amp;gt;name&lt;/span&gt;&lt;span class="se"&gt;\n&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;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;FootballBoy&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="nc"&gt;Boy&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;play&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$this-&amp;gt;name&lt;/span&gt;&lt;span class="s2"&gt; is playing football&lt;/span&gt;&lt;span class="se"&gt;\n&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;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nv"&gt;$jack&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;FootballBoy&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Jack"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nv"&gt;$jack&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;sayHello&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="nv"&gt;$jack&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;play&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

&lt;span class="cp"&gt;?&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  What’s Going On?
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;Boy&lt;/code&gt; is abstract.&lt;/li&gt;
&lt;li&gt;It has an abstract method &lt;code&gt;play()&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;FootballBoy&lt;/code&gt; extends &lt;code&gt;Boy&lt;/code&gt; and defines &lt;code&gt;play()&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;We can create a &lt;code&gt;FootballBoy&lt;/code&gt;, but not a plain &lt;code&gt;Boy&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Example 2: Abstract Class &lt;code&gt;Girl&lt;/code&gt;
&lt;/h2&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;abstract&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Girl&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;protected&lt;/span&gt; &lt;span class="nv"&gt;$hobby&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="nv"&gt;$hobby&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nv"&gt;$this&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;hobby&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;$hobby&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="k"&gt;abstract&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;dance&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;showHobby&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"My hobby is &lt;/span&gt;&lt;span class="nv"&gt;$this-&amp;gt;hobby&lt;/span&gt;&lt;span class="se"&gt;\n&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;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;BalletGirl&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="nc"&gt;Girl&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;dance&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"Dancing ballet gracefully&lt;/span&gt;&lt;span class="se"&gt;\n&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;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nv"&gt;$anna&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;BalletGirl&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"ballet"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nv"&gt;$anna&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;showHobby&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="nv"&gt;$anna&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;dance&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

&lt;span class="cp"&gt;?&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Key Points
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Abstract class helps share common logic (&lt;code&gt;showHobby()&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;It requires child classes to implement &lt;code&gt;dance()&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Example 3: Abstract Class &lt;code&gt;Donkey&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;Yes, even donkeys can use OOP.&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="cp"&gt;&amp;lt;?php&lt;/span&gt;

&lt;span class="k"&gt;abstract&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Donkey&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;abstract&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;makeSound&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;walk&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"Donkey walking slowly...&lt;/span&gt;&lt;span class="se"&gt;\n&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;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;TalkingDonkey&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="nc"&gt;Donkey&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;makeSound&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"Hee-haw! I can talk!&lt;/span&gt;&lt;span class="se"&gt;\n&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;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nv"&gt;$donkey&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;TalkingDonkey&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="nv"&gt;$donkey&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;walk&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="nv"&gt;$donkey&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;makeSound&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

&lt;span class="cp"&gt;?&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  What Did You Learn?
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Donkey class gives a &lt;code&gt;walk()&lt;/code&gt; method.&lt;/li&gt;
&lt;li&gt;Every subclass must define &lt;code&gt;makeSound()&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Rules of Abstract Classes
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;You can't create objects from abstract classes.&lt;/li&gt;
&lt;li&gt;Abstract methods can't have a body.&lt;/li&gt;
&lt;li&gt;If a class has one abstract method, the whole class must be abstract.&lt;/li&gt;
&lt;li&gt;A child must implement all abstract methods.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  When Should You Use One?
&lt;/h2&gt;

&lt;p&gt;Use an abstract class when:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You need to define a contract for child classes.&lt;/li&gt;
&lt;li&gt;You want to avoid repeating the same code.&lt;/li&gt;
&lt;li&gt;You need partial implementation and want subclasses to finish the job.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Final Thoughts
&lt;/h2&gt;

&lt;p&gt;Abstract classes in PHP make your code structured, reusable, and clean. It’s like giving your classes a rulebook. With fun examples like &lt;code&gt;Boy&lt;/code&gt;, &lt;code&gt;Girl&lt;/code&gt;, and &lt;code&gt;Donkey&lt;/code&gt;, you can understand how it works without stress.&lt;/p&gt;

&lt;p&gt;Now go write your own abstract classes—and maybe teach your own donkey to code.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>php</category>
      <category>web3</category>
      <category>programming</category>
    </item>
    <item>
      <title>Understanding PHP Predefined Constants</title>
      <dc:creator>Patricia Hernandez</dc:creator>
      <pubDate>Thu, 14 Dec 2023 23:16:29 +0000</pubDate>
      <link>https://forem.com/patricia1988hernandez2/understanding-php-predefined-constants-6db</link>
      <guid>https://forem.com/patricia1988hernandez2/understanding-php-predefined-constants-6db</guid>
      <description>&lt;p&gt;PHP, as a dynamic and widely-used scripting language, comes equipped with an array of predefined constants. &lt;/p&gt;

&lt;p&gt;These constants, inherently part of the PHP core, are essential building blocks that provide valuable insights into the PHP environment and its configuration. &lt;/p&gt;

&lt;p&gt;Let's embark on a journey to understand and leverage these constants for more robust and efficient PHP development.&lt;/p&gt;

&lt;p&gt;At the heart of PHP's self-awareness lie constants that reveal vital version information. These constants include:&lt;/p&gt;

&lt;h2&gt;
  
  
  PHP Version Information
&lt;/h2&gt;

&lt;p&gt;PHP_VERSION (string): Presents the current PHP version in a structured notation.&lt;/p&gt;

&lt;p&gt;PHP_MAJOR_VERSION (int): Specifies the major version of PHP, offering an integer representation.&lt;/p&gt;

&lt;p&gt;PHP_MINOR_VERSION (int): Reveals the minor version of PHP as an integer.&lt;/p&gt;

&lt;p&gt;PHP_RELEASE_VERSION (int): Represents the release version of PHP in integer format.&lt;/p&gt;

&lt;p&gt;PHP_VERSION_ID (int): Expresses the PHP version as an integer, facilitating version comparisons.&lt;/p&gt;

&lt;p&gt;PHP_EXTRA_VERSION (string): Unveils any additional version information, often utilized by distribution vendors.&lt;/p&gt;

&lt;h2&gt;
  
  
  System and Configuration Constants
&lt;/h2&gt;

&lt;p&gt;PHP's interaction with the system and its configuration is encapsulated in a set of constants:&lt;/p&gt;

&lt;p&gt;PHP_OS (string): Identifies the operating system for which PHP was built.&lt;/p&gt;

&lt;p&gt;PHP_OS_FAMILY (string): Classifies the operating system family, such as 'Windows,' 'BSD,' or 'Linux' (available since PHP 7.2.0).&lt;/p&gt;

&lt;p&gt;PHP_SAPI (string): Specifies the Server API for the current PHP build, offering insights into the server environment.&lt;/p&gt;

&lt;p&gt;PHP_EOL (string): Provides the correct 'End Of Line' symbol for the platform, aiding in cross-platform compatibility.&lt;/p&gt;

&lt;p&gt;Navigating the numeric landscape, &lt;a href="https://flatcoding.com/tutorials/php-programming/php-predefined-constants/" rel="noopener noreferrer"&gt;PHP predefined constants&lt;/a&gt; offer insights into integer and float capabilities:&lt;/p&gt;

&lt;p&gt;PHP_INT_MAX (int): Indicates the largest supported integer, crucial for handling numerical limits.&lt;/p&gt;

&lt;p&gt;PHP_INT_MIN (int): Unveils the smallest supported integer, maintaining consistency across systems.&lt;/p&gt;

&lt;p&gt;PHP_INT_SIZE (int): Specifies the size of an integer in bytes, contributing to efficient memory management.&lt;/p&gt;

&lt;p&gt;PHP_FLOAT_DIG (int), PHP_FLOAT_EPSILON (float), PHP_FLOAT_MIN (float), PHP_FLOAT_MAX (float): Introduce precision-related constants, enhancing float handling.&lt;/p&gt;

&lt;p&gt;Efficiently managing file paths and directories is simplified with the following constants:&lt;/p&gt;

&lt;p&gt;DEFAULT_INCLUDE_PATH, PEAR_INSTALL_DIR, PEAR_EXTENSION_DIR, PHP_EXTENSION_DIR, PHP_PREFIX, PHP_BINDIR: Offer insights into default directories and prefixes, guiding the search for dynamically loadable extensions.&lt;br&gt;
Error Reporting Constants&lt;br&gt;
PHP's error reporting capabilities are enhanced through a comprehensive set of constants:&lt;/p&gt;

&lt;p&gt;Constants like E_ERROR, E_WARNING, E_PARSE, E_NOTICE, E_CORE_ERROR, E_CORE_WARNING, E_COMPILE_ERROR, E_COMPILE_WARNING: Facilitate customizable error reporting.&lt;/p&gt;

&lt;p&gt;E_USER_ERROR, E_USER_WARNING, E_USER_NOTICE, E_RECOVERABLE_ERROR, E_DEPRECATED, E_USER_DEPRECATED, E_ALL, E_STRICT: Provide additional granularity for user-defined errors and reporting levels.&lt;/p&gt;

&lt;p&gt;Boolean and Null Constants&lt;br&gt;
Simplifying boolean and null representations in PHP:&lt;/p&gt;

&lt;p&gt;true (bool), false (bool), null (null): Essential constants that represent boolean and null values.&lt;br&gt;
Windows-Specific Constants&lt;br&gt;
For developers navigating the Windows environment, PHP offers specialized constants:&lt;/p&gt;

&lt;p&gt;PHP_WINDOWS_EVENT_CTRL_C (int), PHP_WINDOWS_EVENT_CTRL_BREAK (int): Windows-specific constants representing CTRL+C and CTRL+BREAK events (available since PHP 7.4.0).&lt;br&gt;
These constants, collectively, empower PHP developers to write more adaptable, version-aware, and error-resilient code. By understanding and leveraging these constants, developers can ensure compatibility, streamline configurations, and enhance the overall robustness of their PHP applications.&lt;/p&gt;

&lt;p&gt;To see more tutorial visit &lt;a href="https://flatcoding.com/" rel="noopener noreferrer"&gt;Flat Coding&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;You can also read this article:&lt;br&gt;
&lt;a href="https://dev.to/montasser/understand-how-the-abstract-class-works-in-php-5bff"&gt;https://dev.to/montasser/understand-how-the-abstract-class-works-in-php-5bff&lt;/a&gt;&lt;/p&gt;

</description>
      <category>php</category>
      <category>programming</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Create a New Branch in Git</title>
      <dc:creator>Patricia Hernandez</dc:creator>
      <pubDate>Tue, 23 May 2023 20:38:29 +0000</pubDate>
      <link>https://forem.com/patricia1988hernandez2/create-a-new-branch-in-git-5l9</link>
      <guid>https://forem.com/patricia1988hernandez2/create-a-new-branch-in-git-5l9</guid>
      <description>&lt;p&gt;In this article, we will explore the process of creating a branch in Git and discuss the various commands and options available.&lt;/p&gt;

&lt;h2&gt;
  
  
  Getting Started
&lt;/h2&gt;

&lt;p&gt;To create a branch in Git, you need to have Git installed on your system and have a repository set up. Once you have fulfilled these prerequisites, you can follow the steps outlined below.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 1: Opening the Terminal
&lt;/h2&gt;

&lt;p&gt;Firstly, open your preferred terminal application. This could be the default terminal on your operating system or a dedicated terminal program like Git Bash.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2: Go to the folder that contains your Git repository
&lt;/h2&gt;

&lt;p&gt;You can use the cd command followed by the path to the repository folder. For example, if your repository is in the ~/projects/my-repo folder, you would run the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; ~/projects/my-repo
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 3: Checking the Current Branch
&lt;/h2&gt;

&lt;p&gt;Before creating a new branch, it's a good practice to check which branch you are currently on. This step ensures that you are aware of the branch you are branching off from. To display the current branch, use the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git branch
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This command lists all the branches in your repository and highlights the branch you are currently on. The current branch is denoted by an asterisk (*) before its name.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 4: Creating a New Branch
&lt;/h2&gt;

&lt;p&gt;Now that you are in the correct repository and aware of the current branch, it's time to &lt;a href="https://flatcoding.com/tutorials/git-version-control/git-create-branch-cli/" rel="noopener noreferrer"&gt;create a new branch&lt;/a&gt;. To create a branch, use the git branch command followed by the desired branch name. For example, to create a branch named "feature-x", execute the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git branch feature-x
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This command creates a new branch named "feature-x" based on the current branch. However, the new branch is not yet activated; it's merely created as a reference to a specific commit.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 5: Switching to the New Branch
&lt;/h2&gt;

&lt;p&gt;To start working on the newly created branch, you need to switch to it. To change branches, Git offers the "git checkout" command. Execute the following command to switch to the newly created branch:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git checkout feature-x
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This command activates the branch named "feature-x" and updates your working directory to reflect the state of that branch.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 6: Verifying the Switch
&lt;/h2&gt;

&lt;p&gt;To verify that you have successfully switched to the new branch, you can run the git branch command again. The current branch (the one you switched to) should now be highlighted with an asterisk (*) in the output.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git branch
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Wrapping Up
&lt;/h2&gt;

&lt;p&gt;Creating branches in Git allows developers to work on different aspects of a project simultaneously while maintaining code integrity. By following the steps outlined in this article, you can confidently create a new branch, switch to it, and start working on your code changes without affecting the main codebase. Utilize Git's branching capabilities to enhance your development workflow and collaborate seamlessly with your team.&lt;/p&gt;

&lt;p&gt;To see more tutorials about git visit &lt;a href="https://flatcoding.com/" rel="noopener noreferrer"&gt;Flat Coding&lt;/a&gt;&lt;/p&gt;

</description>
      <category>git</category>
      <category>github</category>
      <category>programming</category>
      <category>beginners</category>
    </item>
    <item>
      <title>PHP OR Operator (||)</title>
      <dc:creator>Patricia Hernandez</dc:creator>
      <pubDate>Wed, 16 Nov 2022 18:15:04 +0000</pubDate>
      <link>https://forem.com/patricia1988hernandez2/php-or-operator--3cmk</link>
      <guid>https://forem.com/patricia1988hernandez2/php-or-operator--3cmk</guid>
      <description>&lt;p&gt;The PHP or operator used to check for only one true result of many expressions So that means only one operand should has a true result to show you a true result value. Otherwise it will show you a false Boolean value.&lt;/p&gt;

&lt;p&gt;Lets take an example.&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="cp"&gt;&amp;lt;?php&lt;/span&gt;
  &lt;span class="nv"&gt;$val&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;52&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nb"&gt;Var_dump&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$val&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// true&lt;/span&gt;
&lt;span class="cp"&gt;?&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This example will show you a true value because any positive or negative number means it has a value but if it has 0 it will show you a false value.&lt;/p&gt;

&lt;p&gt;That means the interpreter will use the &lt;a href="https://flatcoding.com/tutorials/php-programming/php-type-juggling/" rel="noopener noreferrer"&gt;PHP type juggling&lt;/a&gt; to convert the integer value to Boolean value during the execution, so, the true take any positive or negative value and 0 means false Boolean value.&lt;/p&gt;

&lt;p&gt;To analyze this example the 52 is not zero number and not empty.&lt;/p&gt;

&lt;p&gt;The value will be true and the 20 value will be the same result as a true Boolean value so the final result will be true.&lt;/p&gt;

&lt;p&gt;In in the next example will use another integer expression.&lt;/p&gt;

&lt;h2&gt;
  
  
  PHP OR with Integer Data Types
&lt;/h2&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="nv"&gt;$x&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nb"&gt;var_dump&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$x&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// true;&lt;/span&gt;
&lt;span class="cp"&gt;?&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example, you will see two values with OR logical operator, as I mentioned before, the full result will determined according to true boolean operand.&lt;/p&gt;

&lt;p&gt;So -10 means not empty and not zero value that will convert the integer type to true and 0 converted to false value.&lt;/p&gt;

&lt;p&gt;The final result will true.&lt;/p&gt;

&lt;h2&gt;
  
  
  PHP OR with a String and NULL Data Types
&lt;/h2&gt;

&lt;p&gt;Anyway, in the following block I will use the same operator with another string data 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="cp"&gt;&amp;lt;?php&lt;/span&gt;
  &lt;span class="nv"&gt;$string&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nb"&gt;var_dump&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$string&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// false   &lt;/span&gt;

&lt;span class="cp"&gt;?&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These two operands will return a false value which will return a false boolean value.&lt;/p&gt;

&lt;p&gt;Anyway, there are two empty values so it will show you a false boolean value.&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="cp"&gt;&amp;lt;?php&lt;/span&gt;
  &lt;span class="nv"&gt;$value&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;  &lt;span class="s2"&gt;"value 1"&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nb"&gt;var_dump&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$value&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// true;&lt;/span&gt;
&lt;span class="cp"&gt;?&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example I will show you a true boolean value because there is an operand has no empty value.&lt;/p&gt;

&lt;h2&gt;
  
  
  Wrapping Up
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://flatcoding.com/tutorials/php-programming/php-or-operator/" rel="noopener noreferrer"&gt;PHP OR&lt;/a&gt; operator is a logical operator used to check if one operand has a true value so it will show you a true boolean result. &lt;/p&gt;

&lt;p&gt;That’s all, thank you for reading.&lt;/p&gt;

&lt;h2&gt;
  
  
  Resources
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://flatcoding.com/" rel="noopener noreferrer"&gt;Flat Coding&lt;/a&gt;&lt;/p&gt;

</description>
      <category>programming</category>
      <category>php</category>
      <category>webdev</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Python Online Interpreter</title>
      <dc:creator>Patricia Hernandez</dc:creator>
      <pubDate>Thu, 22 Sep 2022 10:28:16 +0000</pubDate>
      <link>https://forem.com/patricia1988hernandez2/free-online-python-compiler-and-interpreter-39ji</link>
      <guid>https://forem.com/patricia1988hernandez2/free-online-python-compiler-and-interpreter-39ji</guid>
      <description>&lt;p&gt;In this tutorial, I am going to explain how to use the free online python compiler, and you will understand how the python interpreter works.&lt;/p&gt;

&lt;p&gt;Let's get started&lt;/p&gt;

&lt;h2&gt;
  
  
  An Overview
&lt;/h2&gt;

&lt;p&gt;The &lt;a href="https://codedtag.com/python/free-online-python-compiler-interpreter/" rel="noopener noreferrer"&gt;online python compiler&lt;/a&gt; is depending on virtual private server.&lt;/p&gt;

&lt;p&gt;Fast and integrated with a live session on the VPS. They are trying to include some libraries and modules.&lt;/p&gt;

&lt;p&gt;It is completely free and including many features to allow you trying your python code with the web browser.&lt;/p&gt;

&lt;p&gt;The free online python compiler is designed by &lt;a href="https://codedtag.com" rel="noopener noreferrer"&gt;CodedTag&lt;/a&gt; developers which are working on famous applications as freelancers on themeforest, upwork, and so many others.&lt;/p&gt;

&lt;p&gt;Python is a high level language that written in C programming language. It designed to do web applications, desktop apps, machine learning, and som many else&lt;/p&gt;

&lt;p&gt;In the following paragraph, I will explain how to use the online python compiler.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to use the online python compiler
&lt;/h2&gt;

&lt;p&gt;It is so easy you have to write your python code in the left editor but make sure for the indentation rules.&lt;/p&gt;

&lt;p&gt;Once you finish your code, you have to click on the “Run” button to see the results on the right preview screen.&lt;/p&gt;

&lt;p&gt;If you need to read PHP tutorials, follow this &lt;a href="https://dev.to/montasser/understand-how-the-abstract-class-works-in-php-5bff"&gt;article&lt;/a&gt;&lt;/p&gt;

</description>
      <category>python</category>
      <category>computerscience</category>
      <category>webdev</category>
      <category>programming</category>
    </item>
    <item>
      <title>Remove the Last Char from a PHP String</title>
      <dc:creator>Patricia Hernandez</dc:creator>
      <pubDate>Thu, 25 Aug 2022 14:51:11 +0000</pubDate>
      <link>https://forem.com/patricia1988hernandez2/remove-the-last-char-from-a-php-string-39eo</link>
      <guid>https://forem.com/patricia1988hernandez2/remove-the-last-char-from-a-php-string-39eo</guid>
      <description>&lt;p&gt;In this article, you will understand more than one way to remove the last char from the PHP string.&lt;/p&gt;

&lt;p&gt;Anyway, the question is how to use &lt;a href="https://flatcoding.com/tutorials/php-programming/t/examples/php-remove-last-character-from-string/" rel="noopener noreferrer"&gt;PHP to remove the last character from the string&lt;/a&gt;. In the following sections, I am going to cover 2 ways that are doing that.&lt;/p&gt;

&lt;h2&gt;
  
  
  Using the Substr Replace Function
&lt;/h2&gt;

&lt;p&gt;The substr_replace is a predefined PHP function used to replace a part from text with another one.&lt;/p&gt;

&lt;p&gt;It takes four parameters, such as&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;the $string variable is for the PHP string sentence&lt;/li&gt;
&lt;li&gt;the $replace variable is for the needed string that would replace on the old part.&lt;/li&gt;
&lt;li&gt;$offset to select the started index from left to right and if it take a negative value that means it will start from the right.&lt;/li&gt;
&lt;li&gt;And the final is an optional parameter with $length.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Let's take an example.&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="cp"&gt;&amp;lt;?php&lt;/span&gt;
&lt;span class="nv"&gt;$string&lt;/span&gt;  &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"My Office behind the Door.."&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nv"&gt;$replace&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nv"&gt;$offset&lt;/span&gt;  &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; 
&lt;span class="k"&gt;echo&lt;/span&gt; &lt;span class="nb"&gt;substr_replace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="nv"&gt;$string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$replace&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$offset&lt;/span&gt; &lt;span class="p"&gt;);&lt;/span&gt;  
&lt;span class="c1"&gt;// The output: My Office behind the Door.&lt;/span&gt;
&lt;span class="cp"&gt;?&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As you saw, the value was printed is the full sentence but deleted the last dot from the string. But how to replace a word instead of another word.&lt;/p&gt;

&lt;p&gt;To do that, you have to select the first char from the target word and know the index number and then set a new value with the $replace variable&lt;/p&gt;

&lt;p&gt;Let's see that with the following code.&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="cp"&gt;&amp;lt;?php&lt;/span&gt; 
  &lt;span class="nv"&gt;$string&lt;/span&gt;  &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"Hello World"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nv"&gt;$replace&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"Petter"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nv"&gt;$offset&lt;/span&gt;  &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// is the begining of the Wolrd word. &lt;/span&gt;
  &lt;span class="k"&gt;echo&lt;/span&gt; &lt;span class="nb"&gt;substr_replace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="nv"&gt;$string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$replace&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$offset&lt;/span&gt; &lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="c1"&gt;// The output: Hello Peter &lt;/span&gt;
&lt;span class="cp"&gt;?&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Remove the Last Character using the Mb Substr Function
&lt;/h2&gt;

&lt;p&gt;The mb_substr is only getting a part from the target string. That means, we need only to return the need part without the last Character.&lt;/p&gt;

&lt;p&gt;Let's see that in the following PHP code.&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="cp"&gt;&amp;lt;?php&lt;/span&gt; 
  &lt;span class="nv"&gt;$string&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"Am I Doing That ?"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;echo&lt;/span&gt; &lt;span class="nb"&gt;mb_substr&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="nv"&gt;$string&lt;/span&gt; &lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// Am I Doing That&lt;/span&gt;
&lt;span class="cp"&gt;?&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Wrapping Up
&lt;/h2&gt;

&lt;p&gt;In this article, you understood what is substr_replace function and how to use it to replace a string from a sentence. Also you learned how to remove the last char from a PHP string using two predefined PHP functions.&lt;/p&gt;

&lt;p&gt;To learn more ways, follow the &lt;a href="https://flatcoding.com/" rel="noopener noreferrer"&gt;Flat Coding&lt;/a&gt; tutorils&lt;/p&gt;

&lt;p&gt;Thanks for reading, stay tuned for my &lt;a href="https://cleancoding.hashnode.dev/oop-in-php-what-you-need-to-know" rel="noopener noreferrer"&gt;next tutorials&lt;/a&gt;&lt;/p&gt;

</description>
      <category>php</category>
      <category>webdev</category>
      <category>beginners</category>
      <category>programming</category>
    </item>
    <item>
      <title>What is PHP and How PHP Interpreter Works</title>
      <dc:creator>Patricia Hernandez</dc:creator>
      <pubDate>Mon, 04 Jul 2022 19:59:00 +0000</pubDate>
      <link>https://forem.com/patricia1988hernandez2/what-is-php-and-how-php-interpreter-works-38k8</link>
      <guid>https://forem.com/patricia1988hernandez2/what-is-php-and-how-php-interpreter-works-38k8</guid>
      <description>&lt;p&gt;PHP is open-source and depended on the interpreter to parse and execute the source code and get back with the result in a few moments. PHP is the most popular scripting language in web development. And there are some developers using it in machine learning.&lt;/p&gt;

&lt;h2&gt;
  
  
  An Inroduction
&lt;/h2&gt;

&lt;p&gt;Actually, PHP is designed by Rasmus Lerdorf in 1994 and written in C programming language, starting with the name PHP/FI as the first scripting language on the planet for web development.&lt;/p&gt;

&lt;p&gt;PHP started as a common gateway interface binaries.it has already been created to follow the visitors for their resumes on the internet.&lt;/p&gt;

&lt;h2&gt;
  
  
  How PHP Works
&lt;/h2&gt;

&lt;p&gt;The interpreting process should start with the browser when the user loads the web page or open any site that interacts with the PHP server.&lt;/p&gt;

&lt;p&gt;The client sent a request from the web server during the previous process. The web server takes this source code and interprets the source code line by line. then it responds with the result.&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%2Fn7pdgy1krdr0pebzwc49.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%2Fn7pdgy1krdr0pebzwc49.png" alt="Image description" width="800" height="448"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;But how does the interpreter work behind the scene? To answer this question first, you have to read more about &lt;a href="https://flatcoding.com/tutorials/php-programming/what-is-php-how-to-write-php-program/" rel="noopener noreferrer"&gt;what PHP is and try to write your firts PHP program&lt;/a&gt; and know the difference between the compiler and the interpreter.&lt;/p&gt;

&lt;h2&gt;
  
  
  Understanding The Diffrence Between The Compiler and The Interpreter
&lt;/h2&gt;

&lt;p&gt;Two both compiler and interpreter are helping us to translate the source code of the high-level programming language into machine code but there are many factors are distinguish one from the other. Let's see that. &lt;/p&gt;

&lt;p&gt;&lt;u&gt;&lt;strong&gt;The compiler&lt;/strong&gt;&lt;/u&gt; translates the source code into machine code in one piece, so when you run the program the compiler is taking the full source code and executing it one single time.&lt;/p&gt;

&lt;p&gt;In this way, you will not be able to fix errors that may happen during the program execution in the stack.&lt;/p&gt;

&lt;p&gt;If your code has an issue with the syntax the compiler will track it right away and show you a message containing the line number of the issue in your editor and also show you what is the problem.&lt;/p&gt;

&lt;p&gt;The compiler takes some while to analyze the source code but the overall time is faster in the execution.&lt;/p&gt;

&lt;p&gt;The compiler is used in high-level programming languages like C++, C, C# and java.&lt;/p&gt;

&lt;p&gt;Otherwise,&lt;/p&gt;

&lt;p&gt;&lt;u&gt;&lt;strong&gt;The interpreter&lt;/strong&gt;&lt;/u&gt; translates the source code line by line which is taking your source code and converting it to binaries 0101 the machine language.&lt;/p&gt;

&lt;p&gt;You will be able to rewrite and fix issues during the program execution but there is no issue tracker.&lt;/p&gt;

&lt;p&gt;The interpreter is slower than the compiler but it is faster in the source code analysis.&lt;/p&gt;

&lt;p&gt;The interpreter is used in high-level programming and scripting languages like JavaScript, PHP, Python and Ruby.&lt;/p&gt;

&lt;h2&gt;
  
  
  How PHP Interpreter Works
&lt;/h2&gt;

&lt;p&gt;The name of the PHP interpreter is Zend Engine developed by the Zend company for software. The Zend Engine is already inside the PHP package so when you install PHP it will install Zend Engine directly at the same time.&lt;/p&gt;

&lt;p&gt;Actually, there are four stages in the Zend Engine interpreter to interpret PHP source code.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1 - Tokenizing Or Lexical Analysis&lt;/strong&gt;&lt;br&gt;
It takes the source code contents from the PHP programming language. Then converts all the syntaxes into a list of tokens and delete all comments tag and whitespaces from the source code.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2 - Analysis By The Parser&lt;/strong&gt;&lt;br&gt;
The purpose of this phase is to generate the (AST) structures, in this step, the parser is taking the source code from the tokenizing step and converts it to a big tree&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3 - The Compilation&lt;/strong&gt;&lt;br&gt;
In this phase, the compilation doesn't need a JIT compiler because it already happened in the generated AST. And that according to pass the AST recursively.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4 - The Execution&lt;/strong&gt;&lt;br&gt;
This is the last step in the PHP interpreter, here the Zend Engine Virtual Machine generates an OPCode that already evaluates the final result for the web response.&lt;/p&gt;
&lt;h2&gt;
  
  
  What is The AST
&lt;/h2&gt;

&lt;p&gt;AST stands for Abstract Syntax Tree used in the parser of the interpreter. The mission of the AST is to take the syntax of the source code and converts it into a structure tree.&lt;/p&gt;

&lt;p&gt;The main advantage of AST is the validating and parsing of every part in the implementation.&lt;/p&gt;

&lt;p&gt;Let's see how the abstract syntax tree represents the below PHP code.&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="cp"&gt;&amp;lt;?php&lt;/span&gt;
  &lt;span class="nv"&gt;$x&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;while&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="nv"&gt;$x&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; 
     &lt;span class="nv"&gt;$x&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="cp"&gt;?&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&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%2Fwrc7y4a111vw29q18q4a.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%2Fwrc7y4a111vw29q18q4a.png" alt="Image description" width="800" height="417"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;In this tutorial, we explained what is PHP, and how the Zend Engine works. &lt;br&gt;
Also, we exposed what is the difference between the compiler and the interpreter. &lt;/p&gt;

&lt;p&gt;You can also follow this &lt;a href="https://www.linkedin.com/pulse/what-php-used-montaser-mossallem-7elvc" rel="noopener noreferrer"&gt;article&lt;/a&gt; to see more details about PHP.&lt;/p&gt;

&lt;p&gt;Thank you for reading. &lt;/p&gt;

&lt;h2&gt;
  
  
  Resources
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://flatcoding.com" rel="noopener noreferrer"&gt;Flat Coding&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>beginners</category>
      <category>programming</category>
      <category>php</category>
    </item>
  </channel>
</rss>
