<?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: Dennis Temoye</title>
    <description>The latest articles on Forem by Dennis Temoye (@dennis1001).</description>
    <link>https://forem.com/dennis1001</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%2F669595%2F568bc4ab-c3d9-44cb-a58a-6663faa04468.jpg</url>
      <title>Forem: Dennis Temoye</title>
      <link>https://forem.com/dennis1001</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/dennis1001"/>
    <language>en</language>
    <item>
      <title>How to Convert a String to Uppercase and Lowercase in JavaScript</title>
      <dc:creator>Dennis Temoye</dc:creator>
      <pubDate>Wed, 24 Aug 2022 10:36:25 +0000</pubDate>
      <link>https://forem.com/dennis1001/how-to-convert-a-string-to-uppercase-and-lowercase-in-javascript-251o</link>
      <guid>https://forem.com/dennis1001/how-to-convert-a-string-to-uppercase-and-lowercase-in-javascript-251o</guid>
      <description>&lt;p&gt;During my early days of learning about web development. I had to waste time removing the text and starting over with my Caps-Lock button switched on to change a long sentence from uppercase to lowercase or vice versa.&lt;/p&gt;

&lt;p&gt;In a bid to ensure you don’t go through this stress, hers's how to convert strings to uppercase and to lowercase.&lt;/p&gt;

&lt;p&gt;Convert to Uppercase:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; let person = 'dennis';
  person.toUpperCase(); 
//DENNIS
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Convert to Lowercase:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; let person = 'DENNIS';
  person.toLowerCase(); 
//dennis
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this article, you will learn how to easily convert a string from uppercase to lowercase or vice versa using the JavaScript methods, &lt;code&gt;toLowerCase()&lt;/code&gt; and &lt;code&gt;toUpperCase()&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;In the English language, we have so many ways of displaying text, this could be UPPERCASE, lowercase, Capitalized, CamelCase, and lots more. But for this guide, we are only concerned with UPPERCASE and lowercase.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to Convert a String to Uppercase in JavaScript.
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;toUpperCase()&lt;/code&gt; is a method in JavaScript that convert only the value of the specified string to uppercase (capital letters).&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Note: This JavaScript method, &lt;code&gt;toUpperCase()&lt;/code&gt; and &lt;code&gt;toLowerCase()&lt;/code&gt; doesn't receive parameters, &lt;code&gt;toUpperCase(parameter)&lt;/code&gt;❌.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Let's create a new variable &lt;code&gt;person&lt;/code&gt; to store our string in lowercase and then see how we can convert this string to uppercase:&lt;/p&gt;

&lt;p&gt;Syntax:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let person = 'dennis';
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;To convert a string to uppercase, you will attach the &lt;code&gt;toUpperCase()&lt;/code&gt; method to the variable with a dot (&lt;code&gt;.&lt;/code&gt;):&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;person.toUpperCase();
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;To confirm our output, let’s use the browser console to display the output by using the JavaScript method, &lt;code&gt;console.log()&lt;/code&gt;.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;console.log(person.toUpperCase()); 
// DENNIS
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;We can also create a reusable JavaScript function to implement the &lt;code&gt;toUpperCase()&lt;/code&gt; method by passing in whatever string we wish to convert as an argument:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const person = (parameter) =&amp;gt;{
    console.log(arg.toUpperCase());
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;In the code above, a function with the named &lt;code&gt;person&lt;/code&gt; was created, and then, we use &lt;code&gt;console.log&lt;/code&gt; to display the value after converting the argument to uppercase with the &lt;code&gt;toUpperCase()&lt;/code&gt;  method.&lt;/p&gt;

&lt;p&gt;Once we are creating the function, let's call the function while passing &lt;code&gt;dennis&lt;/code&gt; as the argument.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;person('dennis');
//DENNIS
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
  
  
  How to Convert a String to Lowercase in JavaScript.
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;toLowerCase()&lt;/code&gt; is also a method in JavaScript that convert only the value of the specified string to lowercase (small letters).&lt;/p&gt;

&lt;p&gt;In this section, we will use the same method that we used previously to convert a lowercase string to an uppercase string.&lt;/p&gt;

&lt;p&gt;Since we want to convert an uppercase string to a lowercase string. Our code will look just like this:&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let person = 'DENNIS';
console.log(person.toLowerCase());
//dennis
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;The only difference between this code and the previous one is that the &lt;code&gt;toUpperCase()&lt;/code&gt; method has been replaced with the &lt;code&gt;toLowerCase()&lt;/code&gt; method.&lt;/p&gt;

&lt;p&gt;Let's also create a function to implement the &lt;code&gt;toLowerCase()&lt;/code&gt; method.&lt;/p&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const person = (parameter) =&amp;gt;{&lt;br&gt;
    console.log(arg.toLowerCase());&lt;br&gt;
}

&lt;p&gt;person('DENNIS');&lt;br&gt;
//dennis&lt;br&gt;
&lt;/p&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
&lt;br&gt;
  &lt;br&gt;
  &lt;br&gt;
  Conclusion&lt;br&gt;
&lt;/h2&gt;

&lt;p&gt;In this article, you learned how you can easily convert a string to uppercase and lowercase using the &lt;code&gt;toUpperCase()&lt;/code&gt; and &lt;code&gt;toLowerCase()&lt;/code&gt; JavaScript methods respectively, and you also learned how to achieve this within a JavaScript function.&lt;/p&gt;

&lt;p&gt;Thank you for taking the time to read my article. &lt;/p&gt;

&lt;p&gt;Code with pleasure!&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Understanding Cookies and Sessions in PHP</title>
      <dc:creator>Dennis Temoye</dc:creator>
      <pubDate>Thu, 23 Jun 2022 00:14:51 +0000</pubDate>
      <link>https://forem.com/dennis1001/understanding-cookies-and-sessions-in-php-35k5</link>
      <guid>https://forem.com/dennis1001/understanding-cookies-and-sessions-in-php-35k5</guid>
      <description>&lt;p&gt;Have you ever wondered how your details and recent activities on a website are being saved and remembered by your system? This happens with the help of &lt;strong&gt;cookies&lt;/strong&gt; and &lt;strong&gt;sessions&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;In this article, we will discuss what cookies and sessions are, how cookies and sessions work in PHP, How cookies and sessions are created, accessed, modified, and deleted, and the difference between cookies and sessions in PHP.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Idea Behind Cookies and Sessions in PHP.
&lt;/h2&gt;

&lt;p&gt;If you want to know more about the internet, Cookies and Sessions are two essential things you need to know.&lt;/p&gt;

&lt;p&gt;The idea behind them is that they both save the information of the user, such as login details, recent products checked, etc.&lt;/p&gt;

&lt;p&gt;Cookies are automatically saved whenever a new web page is opened or reloaded. &lt;/p&gt;

&lt;p&gt;Whenever cookies request user information from the server. The server sets a Session ID in the cookies. The server uses that session ID to identify the cookies where the request is coming from.&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%2F95ialyrlxjnprg2btnva.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%2F95ialyrlxjnprg2btnva.png" alt=" " width="800" height="612"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What Are Cookies in PHP?
&lt;/h2&gt;

&lt;p&gt;Cookies are small files of information that are sent to a browser to store a user's information from a particular visited website.&lt;/p&gt;

&lt;p&gt;Cookies stores user information from a website in the browser only and use that information to identify the user when next the user tries to use visit the same website in the browser&lt;/p&gt;

&lt;h2&gt;
  
  
  Setting Cookies in PHP
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;setcookie()&lt;/code&gt; function is used to set a cookie in PHP, it accepts up to six arguments in general, which are all in strings.&lt;/p&gt;

&lt;h4&gt;
  
  
  Syntax:
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;---Php
setcookie(name, value, expire, path, domain, secure)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;The setcookie() function should be called first before any other code is called or executed, just like the code below:&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;These are the descriptions of the setcookie() function parameters:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Parameter&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Name&lt;/td&gt;
&lt;td&gt;This contains the name of the cookie.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Value&lt;/td&gt;
&lt;td&gt;This contains the value of the cookie. This could be in a string or integer form&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Expire&lt;/td&gt;
&lt;td&gt;This will contain the expiration date, of the cookie. If omitted, it will take the default value(0s), and immediately after the user reloads or closes the web page the data in the cookies will be lost. Optional&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Path&lt;/td&gt;
&lt;td&gt;This will contain the path of the cookie in the webserver.  Optional.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Domain&lt;/td&gt;
&lt;td&gt;This will contain the domain works. For example, &lt;a href="http://www.example.com" rel="noopener noreferrer"&gt;www.example.com&lt;/a&gt;. Optional&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Secure&lt;/td&gt;
&lt;td&gt;Optional.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Let's create a PHP file in our code editor(e.g: index.php)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;---Php
&amp;lt;?php
    //Setting cookie
    setcookie(name, value, expire, path, domain, secure);
?&amp;gt;
&amp;lt;html lang="en"&amp;gt;
 &amp;lt;body&amp;gt;

 &amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This previous code is an example that uses the &lt;code&gt;setcookie()&lt;/code&gt; function to create a cookie in PHP. &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The 'expire' parameter is always calculated in seconds. One day is 86,400 seconds. &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The name: 'Username', value: 'Dennis', expire: time() + 86400, path: '/'. we will leave the remaining parameters since they are optional&lt;/p&gt;

&lt;p&gt;&lt;code&gt;time()&lt;/code&gt; is a function that returns the current time.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Defining your path as /, will make the cookie available to all other domains in our browser.&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;---Php
&amp;lt;?php
    //Setting cookie
    setcookie('Username', 'Dennis',  time() + 86400, '/');
?&amp;gt;
&amp;lt;html lang="en"&amp;gt;
 &amp;lt;body&amp;gt;

 &amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  How to Access a cookie in PHP
&lt;/h2&gt;

&lt;p&gt;There are different methods you can access a cookie in PHP, but we take the easy method to achieve this by using either &lt;code&gt;$_COOKIE&lt;/code&gt; or &lt;code&gt;$HTTP_COOKIE_VARS&lt;/code&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;$_COOKIE&lt;/code&gt; and &lt;code&gt;$HTTP_COOKIE_VARS&lt;/code&gt; are both used to retrieve a cookie value. &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The example below shows how we can access a cookie in PHP using &lt;code&gt;$_COOKIE&lt;/code&gt; or &lt;code&gt;$HTTP_COOKIE_VARS&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;---Php
&amp;lt;?php
    //Setting cookie
    setcookie('Username', 'Dennis',  time() + 86400, '/');
?&amp;gt;
&amp;lt;html lang="en"&amp;gt;
 &amp;lt;body&amp;gt;
     &amp;lt;?php
    //Accessing a cookie with $_COOKIE
    echo $_COOKIE["Username"] . "&amp;lt;br/&amp;gt;";

    //Accessing a cookie with $HTTP_COOKIE_VARS
    echo $HTTP_COOKIE_VARS["Username"] . "&amp;lt;br/&amp;gt;";

    ?&amp;gt;
 &amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To check if a cookie is set. Use the &lt;code&gt;isset()&lt;/code&gt; function.&lt;br&gt;
I will illustrate that in the code below.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;---Php
&amp;lt;?php
//Setting cookie
setcookie('Username', 'Dennis',  time() + 86400, '/');
?&amp;gt;
&amp;lt;html lang="en"&amp;gt;

&amp;lt;body&amp;gt;
    &amp;lt;?php
    if (isset($_COOKIE['Username'])) {
        echo "The Username is" . $_COOKIE['Username'];
    } else {

        echo "No Username is found";
    }    ?&amp;gt;
&amp;lt;/body&amp;gt;

&amp;lt;/html&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  How to Delete a cookie in PHP
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;setcookie()&lt;/code&gt; function can be used to delete cookies in PHP just the same as creating a cookie. The only difference is to reverse the expiry time to a past time.&lt;br&gt;
The example below illustrates how we can achieve that.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;---Php
&amp;lt;?php
//Setting cookie
setcookie('Username', 'Dennis',  time() - 86400, '/');
?&amp;gt;

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

&lt;/div&gt;



&lt;h2&gt;
  
  
  What Are Sessions in PHP?
&lt;/h2&gt;

&lt;p&gt;Sessions save the user information and activity on a website to a file in a temporary directory on the server. They make user-stored information available across all other websites the browser&lt;/p&gt;

&lt;p&gt;This user data are stored temporarily on the server. By default, when a user refreshes or closes the browser the user data vanishes from the server.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to Start a Session in PHP.
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;session_start()&lt;/code&gt; is a function that is used to start a session in PHP. &lt;br&gt;
PHP &lt;code&gt;$_SESSION&lt;/code&gt; is a PHP global variable. It is also an array that stores a session variable whenever a session creates a temporary file in the server.&lt;/p&gt;

&lt;p&gt;Let's start a new PHP session and set a few session variables to the &lt;code&gt;$_SESSION&lt;/code&gt; :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;---Php
&amp;lt;?php
session_start();
?&amp;gt;

&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html lang="en"&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;?php
    $_SESSION["name"] = "Dennis";
    ?&amp;gt;
&amp;lt;/body&amp;gt;

&amp;lt;/html&amp;gt;

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

&lt;/div&gt;



&lt;h2&gt;
  
  
  How to Get a Session Variable Values and display it
&lt;/h2&gt;

&lt;p&gt;Here, we will get the Session variable from the previous code. &lt;br&gt;
View this example to get a better understanding:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;---Php
&amp;lt;?php
 session_start(); 
?&amp;gt;
&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html&amp;gt;

&amp;lt;body&amp;gt;
    &amp;lt;?php
    // This will display the name from the previous code
    echo "My name is " . $_SESSION["name"];
    print_r($_SESSION);
    ?&amp;gt;
&amp;lt;/body&amp;gt;

&amp;lt;/html&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  How to Modify a Session Variable
&lt;/h2&gt;

&lt;p&gt;Overwrite the session variable with this code below whenever it is necessary.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;---Php
&amp;lt;?php
session_start();
?&amp;gt;
&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html&amp;gt;

&amp;lt;body&amp;gt;

    &amp;lt;?php
    // Overwrite the session variable here.
    $_SESSION["name"] = "Charity";
    print_r($_SESSION);
    ?&amp;gt;

&amp;lt;/body&amp;gt;

&amp;lt;/html&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  How to destroy a session in PHP.
&lt;/h2&gt;

&lt;p&gt;To remove all variable values from a session, you have to make use of two functions, &lt;code&gt;session_unset()&lt;/code&gt; and &lt;code&gt;session_destroy()&lt;/code&gt;. These functions have different purposes.&lt;br&gt;
Follow this example below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;---php
&amp;lt;?php
session_start();
?&amp;gt;
&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html&amp;gt;
&amp;lt;body&amp;gt;

&amp;lt;?php
// This is to remove all session variables
session_unset();

// This is to destroy the session
session_destroy();
?&amp;gt;

&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Differences Between Cookies and Sessions in PHP.
&lt;/h2&gt;

&lt;p&gt;These are a few differences between cookies and sessions in PHP:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Cookies&lt;/th&gt;
&lt;th&gt;Sessions&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Cookies stores user data in the browser&lt;/td&gt;
&lt;td&gt;Sessions stores user data in the server&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Cookies store user data permanently till the user decides to discard it&lt;/td&gt;
&lt;td&gt;Sessions stores user data temporarily and dispose of it when the user refreshes or closes the browser.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Cookies can easily be accessed by hackers since it stores user data in the browser&lt;/td&gt;
&lt;td&gt;Sessions cannot be accessed by hackers since it stores a user data on the server&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Cookies contain a minimal amount of storage space(4kb) to store user data&lt;/td&gt;
&lt;td&gt;Sessions contain a large amount of storage space(128MB) to store user data&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

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

&lt;p&gt;We learned what Cookies and Sessions are in PHP, their purpose, How they work, and the difference between them. I hope this was helpful. Thank you for taking the time to read this.&lt;/p&gt;

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