<?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: Mikoyoarts</title>
    <description>The latest articles on Forem by Mikoyoarts (@mikoyoarts).</description>
    <link>https://forem.com/mikoyoarts</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%2F171268%2F8ed9b566-6a39-4bb0-ba23-a616e67a1297.jpeg</url>
      <title>Forem: Mikoyoarts</title>
      <link>https://forem.com/mikoyoarts</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/mikoyoarts"/>
    <language>en</language>
    <item>
      <title>PHP Decision Making/Conditional Statements</title>
      <dc:creator>Mikoyoarts</dc:creator>
      <pubDate>Thu, 20 Jun 2019 07:52:09 +0000</pubDate>
      <link>https://forem.com/mikoyoarts/php-decision-making-conditional-statements-41c4</link>
      <guid>https://forem.com/mikoyoarts/php-decision-making-conditional-statements-41c4</guid>
      <description>&lt;p&gt;As human beings we are faced regularly with making one decision or the other. The results of the decisions we make is aimed at solving the challenges we encounter. In PHP there is no difference at all, decision making can also be handled by the PHP programming language thereby making it possible for a particular process to be achieved even without the help of a human being.&lt;/p&gt;

&lt;p&gt;Decisions work based on choices. With each choice, is attached an underlining process which should be executed whenever that choice is picked. Below we will be discussing and explaining some various forms of decision making in the PHP programming language. Follow me gradually and you will get every bit of information along the way.&lt;/p&gt;

&lt;p&gt;Types of PHP Conditional Statements&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The if statement executes some code if one condition is true.
Syntax
if (condition) {
code to be executed if condition is true;
}&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Example&lt;br&gt;
&amp;lt;?php&lt;br&gt;
$t = date("H");&lt;/p&gt;

&lt;p&gt;if ($t &amp;lt; "20") {&lt;br&gt;
    echo "Have a good day!";&lt;br&gt;
}&lt;br&gt;
?&amp;gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The if...else Statement
The if else statement is used to execute a certain code if a condition is true, and another code if the condition is false.
Syntax
if (condition) {
code to be executed if condition is true;
} else {
code to be executed if condition is false;
}&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Example&lt;br&gt;
&amp;lt;?php&lt;br&gt;
$x = 10;&lt;br&gt;
$y = 20;&lt;br&gt;
if ($x &amp;gt;= $y) {&lt;br&gt;
   echo $x;&lt;br&gt;
} else {&lt;br&gt;
   echo $y;&lt;br&gt;
}&lt;br&gt;
?&amp;gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The if...elseif...else Statement
Use the if...elseif...else statement to specify a new condition to test, if the first condition is false.
Syntax
if (condition) {
code to be executed if this condition is true;
} elseif (condition) {
code to be executed if first condition is false and this condition is true;
} else {
code to be executed if all conditions are false;
}&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Example&lt;br&gt;
&amp;lt;?php&lt;br&gt;
$age = 21;&lt;br&gt;
if ($age&amp;lt;=13) {&lt;br&gt;
   echo "Child.";&lt;br&gt;
} elseif ($age&amp;gt;13 &amp;amp;&amp;amp; $age&amp;lt;19) {&lt;br&gt;
   echo "Teenager";&lt;br&gt;
} else {&lt;br&gt;
   echo "Adult";&lt;br&gt;
}&lt;br&gt;
?&amp;gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;The Nested if Statement&lt;br&gt;
Nested if statements means an that there's an if block inside another if block i.e. a control statement inside another control statement.&lt;br&gt;
Syntax&lt;br&gt;
if (condition 1)&lt;br&gt;
{&lt;br&gt;
if (condition 2) {&lt;br&gt;
code to be executed if this condition is true;&lt;br&gt;
} else {&lt;br&gt;
code to be executed if this condition is true;&lt;br&gt;
}&lt;br&gt;
} else {&lt;br&gt;
if (condition 2)&lt;br&gt;
{&lt;br&gt;
code to be executed if this condition is true;&lt;br&gt;
} else {&lt;br&gt;
code to be executed if this condition is true;&lt;br&gt;
}&lt;br&gt;
}&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The Switch Case Statement&lt;br&gt;
The switch statement is an alternative to the if-elseif-else statement. Use the switch statement to select one of a number of blocks of code to be executed.&lt;br&gt;
Syntax&lt;br&gt;
switch (n) {&lt;br&gt;
case value1:&lt;br&gt;
//code to be executed if n=value1&lt;br&gt;
break;&lt;br&gt;
case value2:&lt;br&gt;
 //code to be executed if n=value2&lt;br&gt;
 break;&lt;br&gt;
...&lt;br&gt;
default:&lt;br&gt;
// code to be executed if n is different from all labels&lt;br&gt;
}&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Example&lt;br&gt;
$today = 'Tue';&lt;/p&gt;

&lt;p&gt;switch ($today) {&lt;br&gt;
  case "Mon":&lt;br&gt;
    echo "Today is Monday.";&lt;br&gt;
    break;&lt;br&gt;
  case "Tue":&lt;br&gt;
    echo "Today is Tuesday.";&lt;br&gt;
    break;&lt;br&gt;
  case "Wed":&lt;br&gt;
    echo "Today is Wednesday.";&lt;br&gt;
    break;&lt;br&gt;
  case "Thu":&lt;br&gt;
    echo "Today is Thursday.";&lt;br&gt;
    break;&lt;br&gt;
  case "Fri":&lt;br&gt;
     echo "Today is Friday.";&lt;br&gt;
     break;&lt;br&gt;
  case "Sat":&lt;br&gt;
     echo "Today is Saturday.";&lt;br&gt;
     break;&lt;br&gt;
  case "Sun":&lt;br&gt;
     echo "Today is Sunday.";&lt;br&gt;
     break;&lt;br&gt;
  default:&lt;br&gt;
     echo "Invalid day.";&lt;br&gt;
}&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The Jump Statements
Sometimes you may want to let the loops start without any condition, and allow the statements inside the brackets to decide when to exit the loop. There are two special statements that can be used inside loops: Break and Continue.&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;Break Statement: This ends execution of the current structure. Break accepts an optional numeric argument which tells it how many execution of nested structures to be interrupted.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Example&lt;br&gt;
&amp;lt;?php&lt;br&gt;
   $x = 0 ;&lt;br&gt;
   while($x)&lt;br&gt;
   {&lt;br&gt;
     echo($x . " ");&lt;br&gt;
      if($x == 5)&lt;br&gt;
      {&lt;br&gt;
         break;&lt;br&gt;
      }&lt;br&gt;
      $x ++ ;&lt;br&gt;
   }&lt;br&gt;
  // output 0 1 2 3 4 5&lt;br&gt;&lt;br&gt;
?&amp;gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Continue Statement: This is used to stop processing the current block of code in the loop and goes to the next iteration. The Continue statement as well as the Break can take an optional numeric argument which tells it how many levels of enclosing loops it should skip to the end of.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Example&lt;br&gt;
&amp;lt;?php&lt;br&gt;
   for($i = 0; $i &amp;lt; 5; $i ++)&lt;br&gt;
   {&lt;br&gt;&lt;br&gt;
      if($x == 2)&lt;br&gt;
      {&lt;br&gt;
         continue;&lt;br&gt;
      }&lt;br&gt;
      echo $i . " ";&lt;br&gt;
   }&lt;br&gt;
  // output 0 1  3 4 &lt;br&gt;
?&amp;gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Exit Statement: An exit statement is used to terminate the current execution flow. As soon as an exit statement is found, it will terminate the program.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Example&lt;br&gt;
&amp;lt;?php &lt;br&gt;
$a=5; &lt;br&gt;
$b=5.0; &lt;br&gt;
if($a==$b) &lt;br&gt;
 { &lt;br&gt;
    //terminating script with a message using exit() &lt;br&gt;
    exit('variables are equal'); &lt;br&gt;
 } &lt;br&gt;
else&lt;br&gt;
 { &lt;br&gt;
   //terminating script with a message using exit() &lt;br&gt;
   echo "variables are not equal";&lt;br&gt;
 } &lt;br&gt;
?&amp;gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>opensource</category>
      <category>php</category>
      <category>beginners</category>
    </item>
    <item>
      <title>PHP Building Blocks</title>
      <dc:creator>Mikoyoarts</dc:creator>
      <pubDate>Sat, 08 Jun 2019 07:56:36 +0000</pubDate>
      <link>https://forem.com/mikoyoarts/php-building-blocks-5e7n</link>
      <guid>https://forem.com/mikoyoarts/php-building-blocks-5e7n</guid>
      <description>&lt;ol&gt;
&lt;li&gt;&lt;p&gt;PHP and other Web Scripting Languages:&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Installation of PHP:&lt;br&gt;
In order to develop and run web pages driven by PHP the following softwares are very needful:&lt;br&gt;
i- A Web Server: PHP needs a web server software to be able to execute script which are stored on the server. A number of different web servers exists but the most used is the Apache Server which is open source. The Apache Server can be Downloaded from &lt;a href="https://httpd.apache.org/download.cgi"&gt;https://httpd.apache.org/download.cgi&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;ii- A Database: PHP uses a database for storing files that are being used on any webpage of a given website. A number of databases exist which is very compatible with the PHP scripting language but the most used is My SQL and it is also has an open source version which can be downloaded from &lt;a href="https://www.mysql.com/downloads/"&gt;https://www.mysql.com/downloads/&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;iii- A PHP Parser: The PHP Parser takes a web developer's PHP scripts which has been executed and generates the HTML output which can be sent and displayed on web browsers.&lt;/p&gt;

&lt;p&gt;All the above listed softwares must be downloaded and configured to work with each other before you can start writing and executing PHP scripts on your Computer System. But in recent years, just as technology advances, there has been a release of various software bundles which comprises of all three softwares and the only thing needed is to download them and install and automatically the entire configuration is done during the installation process of these software bundle. Examples of these softwares bundles include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;XAMPP: Cross Platform, Apache, MySQL, PHP and Pearl.&lt;/li&gt;
&lt;li&gt;MAMP: Apple Mac, Apache, MySQL, and PHP.&lt;/li&gt;
&lt;li&gt;LAMP: Linux, Apache, MySQL and PHP.&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;PHP Delimiters:&lt;br&gt;
Delimiters are set of characters used to differentiate the different segments of a written code.&lt;br&gt;
Some examples of PHP delimiters are listed below:&lt;br&gt;
i- PHP open and close tag delimiters (&amp;lt;?php ...?&amp;gt;), PHP short tag (&amp;lt;?...?&amp;gt;), PHP print statement (&amp;lt;?=..;?&amp;gt;)e.t.c. These PHP delimiters enables the identification of PHP scripts.&lt;br&gt;
ii- PHP Alphanumeric delimiters such as forward slashes (/), hash signs (#), comma (,), fullstop (.), tildes (~) e.t.c. These PHP alphanumeric delimiters can be used to split up a string or even convert an array into a string and they also perform many other functions.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Variable initialization with PHP:&lt;br&gt;
Variables are used as "containers" in which we store information. Variables help us create a storage location on the memory of our computer system. The value of variables can be changed as the program code sequence goes on. Just like any other programming language variables must first be initialized before they can be used in PHP. PHP variable initialization is as follows:&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;A PHP variable starts with a dollar sign ($), which is followed by the name of the variable. Example: $variable_name = value;&lt;/p&gt;

&lt;p&gt;Rules for naming a PHP Variable:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A variable name must start with a letter or an underscore&lt;/li&gt;
&lt;li&gt;A variable name cannot start with a number&lt;/li&gt;
&lt;li&gt;A variable name can only contain alpha-numeric characters and underscores (A-z, 0-9, and _ )&lt;/li&gt;
&lt;li&gt;Variable names are case-sensitive ($name and $NAME would be two different variables)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Example using a PHP Scenario:&lt;br&gt;
&amp;lt;?php&lt;br&gt;
   $name = 'John';&lt;br&gt;
   $figure = 25;&lt;br&gt;
?&amp;gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;PHP Data types:
The following are datatypes supported by PHP:&lt;/li&gt;
&lt;li&gt;String, this is a sequence of characters contained within quotes, like "Hello world!"&lt;/li&gt;
&lt;li&gt;Integer, these are whole numbers, without a decimal point, like 4195.&lt;/li&gt;
&lt;li&gt;Float, these are floating-point numbers, like 3.14159 or 49.1.&lt;/li&gt;
&lt;li&gt;Boolean,this have only two possible values either true or false.&lt;/li&gt;
&lt;li&gt;Array, these are named and indexed collections of other values.&lt;/li&gt;
&lt;li&gt;Object, these are instances of programmer-defined classes, which can package up both other kinds of values and functions that are specific to the class.&lt;/li&gt;
&lt;li&gt;NULL, this is a special type that only has one value: NULL.&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Resource, these are special variables that hold references to resources external to PHP (such as database connections).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;PHP Constants:&lt;br&gt;
Constants are similar to variables except that they cannot be changed or undefined after they've been defined.&lt;br&gt;
Begin the name of your constant with a letter or an underscore.&lt;br&gt;
To create a constant, use the define() function:&lt;br&gt;
Example: define(name, value, case-insensitive)&lt;br&gt;
Parameters:&lt;br&gt;
name: Specifies the name of the constant;&lt;br&gt;
value: Specifies the value of the constant;&lt;br&gt;
case-insensitive: Specifies whether the constant name should be case-insensitive. Default is false;&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;example below creates a constant with a case-sensitive name:&lt;br&gt;
&amp;lt;?php&lt;br&gt;
  define("MSG", "Hi SoloLearners!");&lt;br&gt;
  echo MSG;&lt;/p&gt;

&lt;p&gt;// Outputs "Hi SoloLearners!"&lt;br&gt;
?&amp;gt; &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;PHP Operators:
PHP operators are divided into the following categories:
I. Arithmetic Operators

&lt;ul&gt;
&lt;li&gt;Addition, &lt;/li&gt;
&lt;li&gt;Subtraction, &lt;/li&gt;
&lt;li&gt;Multiplication, 
/ Division, 
% Modulus (to get the Remainder in a 
division)
** Exponentiation (to raise to the 
power) &lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;II. Increment &amp;amp; Decrement&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;The increment operators are used to &lt;br&gt;
increment a variable's value.&lt;br&gt;
Types of increment operators&lt;br&gt;
$x++; // post-increment&lt;br&gt;
++$x; // pre-increment&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The decrement operators are used to &lt;br&gt;
decrement a variable's value. &lt;br&gt;
Types of decrement operators&lt;br&gt;
$x--; // post-decrement &lt;br&gt;
--$x; // pre-decrement&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;III. Comparison Operators&lt;/p&gt;

&lt;p&gt;IV. Logical (or Relational) Operators&lt;/p&gt;

&lt;p&gt;V. Assignment Operators&lt;/p&gt;

&lt;p&gt;VI. Conditional (or ternary) Operators&lt;/p&gt;

</description>
      <category>php</category>
      <category>beginners</category>
      <category>webdev</category>
      <category>opensource</category>
    </item>
    <item>
      <title>Getting Started with PHP for WEB</title>
      <dc:creator>Mikoyoarts</dc:creator>
      <pubDate>Fri, 24 May 2019 07:58:41 +0000</pubDate>
      <link>https://forem.com/mikoyoarts/getting-started-with-php-for-web-5foh</link>
      <guid>https://forem.com/mikoyoarts/getting-started-with-php-for-web-5foh</guid>
      <description>&lt;p&gt;What is PHP:&lt;br&gt;
PHP stands for Hypertext Preprocessor. It is an open source server side programming language which is used to create responsive and interactive web pages and websites. PHP is used to write and execute scripts on web servers. A PHP script can contain HTML, CSS and JavaScript codes and when the script is to be saved, it is saved with a .php extension.&lt;/p&gt;

&lt;p&gt;PHP Web Architecture:&lt;br&gt;
PHP codes are executed on a web server after which the result of the executed code is returned in html format i.e. when a user makes a request that is interactive or responsive in nature, php takes that request to the web server and looks for the particular script that is to process such a request and after the request is being processed, its result is returned to the user in html format.&lt;/p&gt;

&lt;p&gt;Overview of PHP Platform:&lt;br&gt;
PHP can be used to generate dynamic page content, create, open, read, write, delete, and close files on the server. It can also be used to collect form data, can send and receive cookies, modify data in a database, control user-access and can also enable a user to encrypt data.&lt;/p&gt;

&lt;p&gt;Origin of PHP in the Open Source Community:&lt;br&gt;
PHP was developed by Rasmus Lerdorf and it's first version was released in 1994. It started out as a small open source project that transformed over time as more and more people found out how useful it was.&lt;/p&gt;

&lt;p&gt;Why we use PHP?:&lt;br&gt;
PHP runs on multiple platforms such as (Windows, Linux, Unix, Mac OS X, etc.), it is compatible with almost all servers used today (Apache, IIS, etc.), it supports a variety of databases, it is free to use and very easy to learn.&lt;/p&gt;

&lt;p&gt;PHP's Strengths:&lt;br&gt;
It is used by "WordPress", the core of the biggest blogging system on the web.&lt;br&gt;
It is deep enough to run "Facebook", the largest social network on the web.&lt;br&gt;
It is very easy for a beginner to learn as his/her first server side programming language.&lt;/p&gt;

&lt;p&gt;Installing as a module for Apache Web Server:&lt;br&gt;
Apache web server is an open source web server which is widely used on the web toady. it comprises of a number of software technologies, thereby making it easy for web developers to just download and use the Apache software bundle without going through the stress of configuring the individual software's they need for their web development. It comprises of a number of software's among which are PHP, My SQL, Maria DB and many more...&lt;/p&gt;

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