<?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>DEV Community: Nachiket Panchal</title>
    <description>The latest articles on DEV Community by Nachiket Panchal (@nachiket).</description>
    <link>https://dev.to/nachiket</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%2F344130%2F44bda2a8-87e2-4fc5-93fc-84f92d2a45e7.jpg</url>
      <title>DEV Community: Nachiket Panchal</title>
      <link>https://dev.to/nachiket</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/nachiket"/>
    <language>en</language>
    <item>
      <title>Angular in Few Words</title>
      <dc:creator>Nachiket Panchal</dc:creator>
      <pubDate>Thu, 19 Aug 2021 17:48:43 +0000</pubDate>
      <link>https://dev.to/nachiket/angular-in-few-words-19d0</link>
      <guid>https://dev.to/nachiket/angular-in-few-words-19d0</guid>
      <description>&lt;p&gt;&lt;a href="https://errorsea.com/angular/"&gt;Angular&lt;/a&gt; is a TypeScript-based open-source front-end framework for single-page applications developed by Google.&lt;/p&gt;

&lt;h3&gt;
  
  
  Where to develop Angular App?
&lt;/h3&gt;

&lt;p&gt;We can install Angular using Nodejs into our Windows/Linux/macOS machine.&lt;/p&gt;

&lt;h3&gt;
  
  
  Which are the important concepts of Angular?
&lt;/h3&gt;

&lt;p&gt;Here are some important concepts of Angular you must learn to be a good angular developer.&lt;/p&gt;

&lt;p&gt;Components, Interpolation, Property Binding, Class Binding, Style Binding, Event Binding, Template Reference Variables, Two-way Data Binding, ngFor Directive, ngIf Directive, ngSwitch Directive, Pipes, Routes, Wild Card Routes, Routing Parameters, Forms&lt;/p&gt;

&lt;p&gt;I hope now you know What is angular, Where to develop it, and Which are the most important concepts to be understood while learning Angular. You can learn the full Angular Tutorial at &lt;a href="https://errorsea.com"&gt;errorsea.com&lt;/a&gt;&lt;/p&gt;

</description>
      <category>angular</category>
      <category>node</category>
      <category>javascript</category>
      <category>webdev</category>
    </item>
    <item>
      <title>How to Compress Image Size Without Losing Quality in PHP</title>
      <dc:creator>Nachiket Panchal</dc:creator>
      <pubDate>Mon, 23 Mar 2020 15:46:46 +0000</pubDate>
      <link>https://dev.to/nachiket/how-to-compress-image-size-without-losing-quality-in-php-4d2h</link>
      <guid>https://dev.to/nachiket/how-to-compress-image-size-without-losing-quality-in-php-4d2h</guid>
      <description>&lt;p&gt;PHP provides the ability to compress images without losing the quality of it. Even more, we can resize images in PHP to generate thumbnails and lightweight web images.&lt;/p&gt;

&lt;p&gt;PHP provides some default functions to compress images and to resize them. Many popular Core-PHP frameworks and CMS use default function to generate thumbnail and images without losing image quality.&lt;/p&gt;

&lt;h2&gt;
  
  
  Image Compression in PHP
&lt;/h2&gt;

&lt;p&gt;Here we are going to learn how to compress an image in PHP without losing its quality in just 2 easy steps.&lt;/p&gt;

&lt;h3&gt;
  
  
  STEP 1: Create an HTML form
&lt;/h3&gt;

&lt;p&gt;First, we have to create a simple HTML form to upload an image file.&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;How to compress an image without losing quality in PHP&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;

&amp;lt;body&amp;gt;
    &amp;lt;form action='' method='POST' enctype='multipart/form-data'&amp;gt;
        &amp;lt;input name="image_file" type="file" accept="image/*"&amp;gt;
        &amp;lt;button type="submit"&amp;gt;SUBMIT&amp;lt;/button&amp;gt;
    &amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;

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


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

&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; &lt;em&gt;enctype=”multipart/form-data”&lt;/em&gt; is compulsory for image upload precess via post method in form.&lt;/p&gt;

&lt;h3&gt;
  
  
  STEP 2: Add below PHP code at the top of PHP file
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

&lt;p&gt;&amp;lt;?php&lt;br&gt;
if ($_SERVER['REQUEST_METHOD'] == "POST")&lt;br&gt;
{&lt;br&gt;
    $file_name = $_FILES["image_file"]["name"];&lt;br&gt;
    $file_type = $_FILES["image_file"]["type"];&lt;br&gt;
    $temp_name = $_FILES["image_file"]["tmp_name"];&lt;br&gt;
    $file_size = $_FILES["image_file"]["size"];&lt;br&gt;
    $error = $_FILES["image_file"]["error"];&lt;br&gt;
    if (!$temp_name)&lt;br&gt;
    {&lt;br&gt;
        echo "ERROR: Please browse for file before uploading";&lt;br&gt;
        exit();&lt;br&gt;
    }&lt;br&gt;
    function compress_image($source_url, $destination_url, $quality)&lt;br&gt;
    {&lt;br&gt;
        $info = getimagesize($source_url);&lt;br&gt;
        if ($info['mime'] == 'image/jpeg') $image = imagecreatefromjpeg($source_url);&lt;br&gt;
        elseif ($info['mime'] == 'image/gif') $image = imagecreatefromgif($source_url);&lt;br&gt;
        elseif ($info['mime'] == 'image/png') $image = imagecreatefrompng($source_url);&lt;br&gt;
        imagejpeg($image, $destination_url, $quality);&lt;br&gt;
        echo "Image uploaded successfully.";&lt;br&gt;
    }&lt;br&gt;
    if ($error &amp;gt; 0)&lt;br&gt;
    {&lt;br&gt;
        echo $error;&lt;br&gt;
    }&lt;br&gt;
    else if (($file_type == "image/gif") || ($file_type == "image/jpeg") || ($file_type == "image/png") || ($file_type == "image/pjpeg"))&lt;br&gt;
    {&lt;br&gt;
        $filename = compress_image($temp_name, "uploads/" . $file_name, 80);&lt;br&gt;
    }&lt;br&gt;
    else&lt;br&gt;
    {&lt;br&gt;
        echo "Uploaded image should be jpg or gif or png.";&lt;br&gt;
    }&lt;br&gt;
} ?&amp;gt;&lt;/p&gt;

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

&lt;/div&gt;
&lt;h4&gt;
&lt;br&gt;
  &lt;br&gt;
  &lt;br&gt;
  Explanation&lt;br&gt;
&lt;/h4&gt;

&lt;p&gt;In the second step first, we checked for the form request method. For File and Image upload &lt;strong&gt;POST&lt;/strong&gt; method is compulsory.&lt;/p&gt;

&lt;p&gt;After that, we defined some variables related to the uploaded file. Like, &lt;strong&gt;File Name&lt;/strong&gt; , &lt;strong&gt;File Type&lt;/strong&gt; , &lt;strong&gt;File Size&lt;/strong&gt; , &lt;strong&gt;Temporary Location of Uploaded File&lt;/strong&gt; , and &lt;strong&gt;Error in File Upload Process&lt;/strong&gt; if any.&lt;/p&gt;

&lt;p&gt;Next, we created a compress_image() function to upload and compress the image. In this function, we passed three variables of the uploaded file.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;$source_url:&lt;/strong&gt;  It is the temporary location in our case of file upload.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;$destination_url:&lt;/strong&gt;  It is the destination path where we want to upload our Image.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;$quality:&lt;/strong&gt; It is the rate of Image quality we want to maintain from 1 to 100. If we want to maintain 100% quality we can simply apply 100 or we can pass 80 if we want to compress and lose the image quality by 20%.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;In the &lt;strong&gt;compress_image()&lt;/strong&gt; function we first found for image specifications by using &lt;strong&gt;getimagesize()&lt;/strong&gt; function and checked for its &lt;strong&gt;mime type&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;From mime type, we checked the image is valid or not and create a related replica of image in PHP according to jpeg, png, gif using &lt;strong&gt;imagecreatefromjpeg()&lt;/strong&gt;, &lt;strong&gt;imagecreatefrompng()&lt;/strong&gt;, &lt;strong&gt;imagecreatefromgif()&lt;/strong&gt; respectively and saved it in &lt;strong&gt;$image&lt;/strong&gt; variable.&lt;/p&gt;

&lt;p&gt;Finally, we created a jpeg image with the help of a $image variable by using &lt;strong&gt;imagejpeg()&lt;/strong&gt; function.&lt;/p&gt;

&lt;p&gt;imagejpeg() function is basically image creator function from raw image data. There are three arguments we passed in imagejpeg() function.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;$image:&lt;/strong&gt; Raw image data we created and stored in $image variable&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;$destination_url:&lt;/strong&gt; Destination Folder/Directory path where we want to create a new image&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;$quality:&lt;/strong&gt; The rate of image quality we want to maintain&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;In the end, we checked for error in the upload process and used our &lt;strong&gt;compress_image()&lt;/strong&gt; function to handle compression of the uploaded image.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; Change the destination directory according to your config. Here we have set the destination path to &lt;strong&gt;uploads/&lt;/strong&gt; in our working directory.&lt;/p&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;In the above article, we learned a complete process of image upload and compression with necessary validations.&lt;/p&gt;

&lt;p&gt;Happy Programming &lt;a href="https://media.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%2Fee02z822yt0l19fsu8k8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fee02z822yt0l19fsu8k8.png" alt="🙂"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The post &lt;a href="https://errorsea.com/how-to-compress-image-size-without-losing-quality-in-php/" rel="noopener noreferrer"&gt;How to Compress Image Size Without Losing Quality in PHP&lt;/a&gt; appeared first on &lt;a href="https://errorsea.com" rel="noopener noreferrer"&gt;errorsea&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>howto</category>
      <category>php</category>
    </item>
    <item>
      <title>How to Add Unlimited Fields in Form Using JavaScript and Store Into Database With PHP</title>
      <dc:creator>Nachiket Panchal</dc:creator>
      <pubDate>Thu, 19 Mar 2020 20:07:23 +0000</pubDate>
      <link>https://dev.to/nachiket/how-to-add-unlimited-fields-in-form-using-javascript-and-store-into-database-with-php-14ni</link>
      <guid>https://dev.to/nachiket/how-to-add-unlimited-fields-in-form-using-javascript-and-store-into-database-with-php-14ni</guid>
      <description>&lt;p&gt;Sometimes we need to add unlimited fields into our form for better user experience. At that time, we can put an &lt;strong&gt;ADD FIELD&lt;/strong&gt; button into the page for dynamic field generation on a webpage.&lt;/p&gt;

&lt;p&gt;Creating unlimited fields in the form is effortless using JavaScript and jQuery. In addition, saving the data into a database is also easy to handle with PHP.&lt;/p&gt;

&lt;h2&gt;
  
  
  Adding Unlimited Fields Using JS and Saving Using PHP
&lt;/h2&gt;

&lt;p&gt;Here we are going to use JavaScript to add new fields and PHP to save data into the database.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step: Create a form and add a function to add new dynamic fields
&lt;/h3&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;body&amp;gt;
        &amp;lt;form id="form" method="POST" action="save_data.php"&amp;gt;
            &amp;lt;input type="text" name="text_field[]"&amp;gt;
            &amp;lt;button type="submit"&amp;gt;SUBMIT&amp;lt;/button&amp;gt;
        &amp;lt;/form&amp;gt;
        &amp;lt;button onclick="add_field()"&amp;gt;ADD FIELD&amp;lt;/button&amp;gt;
        &amp;lt;script&amp;gt;
            function add_field(){

                var x = document.getElementById("form");
                // create an input field to insert
                var new_field = document.createElement("input");
                // set input field data type to text
                new_field.setAttribute("type", "text");
                // set input field name 
                new_field.setAttribute("name", "text_field[]");
                // select last position to insert element before it
                var pos = x.childElementCount;

                // insert element
                x.insertBefore(new_field, x.childNodes[pos]);
            }
        &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;h4&gt;
  
  
  Explanation
&lt;/h4&gt;

&lt;p&gt;Here we created a function named &lt;strong&gt;add_field&lt;/strong&gt; to append a text field at the second last position in the form.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; Here, we set every field name as &lt;strong&gt;text_field[]&lt;/strong&gt;, which submits all text field data as an array.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 2: Create a save_data.php file to store the data to the database
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;?php
    $conn = mysqli_connect("localhost","USER_NAME","PASSWORD","DATABASE_NAME");

    $data = $_POST['text_field'];
    $data = implode(",",$data);

    $query = "INSERT INTO `test`(`data`) VALUES ('$data')";
    if(mysqli_query($conn,$query)){
        echo "Success: Data successfully inserted";
    }else{
        echo "Error: Could not insert data into table";
    }
?&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Explanation
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Here we first stored the submitted array data in a PHP array variable named &lt;strong&gt;$data&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;After that, we used an inbuilt PHP function &lt;strong&gt;implode()&lt;/strong&gt;, which converts an array into a PHP string.&lt;/li&gt;
&lt;li&gt;Finally, we saved our string data to our data table.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://github.com/niick007/errorsea/tree/master/Add%20Unlimited%20Fields%20in%20Form%20Using%20JavaScript"&gt;DOWNLOAD CODE&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;Creating unlimited dynamic fields is very easy using JavaScript. Even more, we learned a way to store that dynamic data into a database using some simple functions of PHP.&lt;/p&gt;

&lt;p&gt;I hope now you have a complete understanding of dynamic field insertion and data storing techniques.&lt;/p&gt;

&lt;p&gt;Enjoy Coding &lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--2EAkP1Kt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://s.w.org/images/core/emoji/12.0.0-1/72x72/1f642.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--2EAkP1Kt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://s.w.org/images/core/emoji/12.0.0-1/72x72/1f642.png" alt="🙂"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The post &lt;a href="https://errorsea.com/how-to-add-unlimited-fields-in-form-using-javascript-and-store-into-database-with-php/"&gt;Add Unlimited Fields in Form Using JavaScript and PHP&lt;/a&gt; appeared first on &lt;a href="https://errorsea.com"&gt;errorsea&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>howto</category>
      <category>javascript</category>
      <category>php</category>
    </item>
    <item>
      <title>How to Change Button Color on Hover Using CSS</title>
      <dc:creator>Nachiket Panchal</dc:creator>
      <pubDate>Sun, 08 Mar 2020 08:45:31 +0000</pubDate>
      <link>https://dev.to/nachiket/how-to-change-button-color-on-hover-using-css-4n1h</link>
      <guid>https://dev.to/nachiket/how-to-change-button-color-on-hover-using-css-4n1h</guid>
      <description>&lt;p&gt;Every element on a website is considered to be important in terms of user experience. In addition, website representation is also another kind of factor which has a significant impact on uses. That’s why buttons and other clickable elements should be user friendly and nice looking.&lt;/p&gt;

&lt;p&gt;Changing the color of buttons on hover looks quite impressive and feels upmarket rather than single color buttons. So here, we are going to discuss how to change the background color of the button using simple CSS. We should also choose the color of the button related to our website color. Even more, the color should be material, so it looks elegant to our users.&lt;/p&gt;

&lt;h2&gt;
  
  
  Change Button Background Color on Hover Using CSS
&lt;/h2&gt;

&lt;p&gt;We have &lt;strong&gt;:hover&lt;/strong&gt; attribute to manage hover events of HTML elements via CSS.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Syntax&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.class\_name:hover{
/* CSS lines */
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Example 1
&lt;/h3&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;Change Button Color on Hover Using CSS - errorsea&amp;lt;/title&amp;gt;
      &amp;lt;style&amp;gt; .myButton{ padding: 10px 20px; background-color: #1E88E5; border: 0px; color: #fff; } .myButton:hover{ background-color: #fff; border: 1px solid #1E88E5; color: #1E88E5; } &amp;lt;/style&amp;gt;
   &amp;lt;/head&amp;gt;
   &amp;lt;body&amp;gt; &amp;lt;button class="myButton"&amp;gt;Hover Me&amp;lt;/button&amp;gt;&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We can also add some transition effects to make it more fluid and user friendly.&lt;/p&gt;

&lt;h3&gt;
  
  
  Example 2
&lt;/h3&gt;

&lt;p&gt;In this example, we have added a little transition effect on hover to make the background color changing process more smooth and meaningful.&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;Change Button Color on Hover Using CSS - errorsea&amp;lt;/title&amp;gt;
      &amp;lt;style&amp;gt; .myButton{ padding: 10px 20px; background-color: #1E88E5; border: 0px; color: #fff; transition: 0.25s linear; } .myButton:hover{ background-color: #fff; border: 1px solid #1E88E5; color: #1E88E5; } &amp;lt;/style&amp;gt;
   &amp;lt;/head&amp;gt;
   &amp;lt;body&amp;gt; &amp;lt;button class="myButton"&amp;gt;Hover Me&amp;lt;/button&amp;gt;&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Enjoy Designing &lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--2EAkP1Kt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://s.w.org/images/core/emoji/12.0.0-1/72x72/1f642.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--2EAkP1Kt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://s.w.org/images/core/emoji/12.0.0-1/72x72/1f642.png" alt="🙂"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The post &lt;a href="https://errorsea.com/how-to-change-button-color-on-hover-using-css/"&gt;How to Change Button Color on Hover Using CSS&lt;/a&gt; appeared first on &lt;a href="https://errorsea.com"&gt;errorsea&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>css</category>
      <category>howto</category>
    </item>
    <item>
      <title>How to Create a Simple PHP REST API</title>
      <dc:creator>Nachiket Panchal</dc:creator>
      <pubDate>Wed, 04 Mar 2020 05:43:11 +0000</pubDate>
      <link>https://dev.to/nachiket/how-to-create-a-simple-php-rest-api-329d</link>
      <guid>https://dev.to/nachiket/how-to-create-a-simple-php-rest-api-329d</guid>
      <description>&lt;p&gt;REST(RESTful) API is the most used method of data transfer. However, there are several other ways to transfer data transfer, but REST is popular among them, so let’s know a little bit about REST APIs.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is the REST API?
&lt;/h2&gt;

&lt;p&gt;REST API is known as RESTful API is a universal method of data transfer, and it becomes more popular due to its flexibility.&lt;/p&gt;

&lt;p&gt;It returns data in JSON format which is supported by all languages. REST API can be integrated with all development platforms.&lt;/p&gt;

&lt;p&gt;Here we are going to discuss how to create a simple REST API in Core PHP.&lt;/p&gt;

&lt;h2&gt;
  
  
  REST API in PHP
&lt;/h2&gt;

&lt;p&gt;PHP is a popular back-end language in web programming. In addition, it can handle simple to complex APIs. Let’s look at an example about REST API in Core PHP.&lt;/p&gt;

&lt;p&gt;PHP has an inbuilt function &lt;strong&gt;json_encode()&lt;/strong&gt; to convert PHP objects into JSON format.&lt;/p&gt;

&lt;h3&gt;
  
  
  Example
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;?php
$object = ['Name' =&amp;gt; 'Nachiket Panchal', 'Link' =&amp;gt; 'errorsea.com', 'data' =&amp;gt; ['Key1' =&amp;gt; 'Value1', 'Key2' =&amp;gt; 'Value2', 'Key3' =&amp;gt; 'Value3']];
header("content-type: application/json");
echo json_encode($object); ?&amp;gt;

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

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Explanation&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;First, we define a &lt;strong&gt;PHP object&lt;/strong&gt; named $object.&lt;/li&gt;
&lt;li&gt;Next, we set a &lt;strong&gt;header&lt;/strong&gt; of &lt;strong&gt;content-type: application/json&lt;/strong&gt; to provide content information to the receiver.&lt;/li&gt;
&lt;li&gt;Finally, we convert our $object variable into json with &lt;strong&gt;json_encode()&lt;/strong&gt; function and echo it.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We can also use a database to create a dynamic API for high-end application development.&lt;/p&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;We have now learned the most basic REST API development using PHP. We can also develop a more advanced API using PHP.&lt;/p&gt;

&lt;p&gt;The post &lt;a href="https://errorsea.com/how-to-create-a-simple-php-rest-api/"&gt;How to Create a Simple PHP REST API&lt;/a&gt; appeared first on &lt;a href="https://errorsea.com"&gt;errorsea&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>howto</category>
      <category>php</category>
    </item>
    <item>
      <title>JQuery Interview Questions</title>
      <dc:creator>Nachiket Panchal</dc:creator>
      <pubDate>Tue, 03 Mar 2020 20:31:22 +0000</pubDate>
      <link>https://dev.to/nachiket/jquery-interview-questions-2b8d</link>
      <guid>https://dev.to/nachiket/jquery-interview-questions-2b8d</guid>
      <description>&lt;h2&gt;Q What is Jquery?&lt;/h2&gt;

&lt;p&gt;&lt;b&gt;Ans. &lt;/b&gt;JQuery is not a programming language, but it is a well-written form of Javascript language.&lt;/p&gt;

&lt;h2&gt;Q What are the features of Jquery?&lt;/h2&gt;

&lt;p&gt;&lt;b&gt;Ans. &lt;/b&gt; Jquery provides the features as follow:&lt;/p&gt;

&lt;ul&gt;
    &lt;li&gt;Fast Execution&lt;/li&gt;
    &lt;li&gt;Less Coding&lt;/li&gt;
    &lt;li&gt;AJAX support&lt;/li&gt;
    &lt;li&gt;DOM Selection&lt;/li&gt;
    &lt;li&gt;Changing CSS&lt;/li&gt;
    &lt;li&gt;Event Handling&lt;/li&gt;
    &lt;li&gt;Easily implementation of animations and effects&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;Q Enlist the different types of selectors in Jquery?&lt;/h2&gt;

&lt;p&gt;&lt;b&gt;Ans. &lt;/b&gt;Jquery has three types of selectors.&lt;/p&gt;

&lt;ul&gt;
    &lt;li&gt;Custom Selector&lt;/li&gt;
    &lt;li&gt;CSS Selector&lt;/li&gt;
    &lt;li&gt;XPath Selector&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;READ MORE: &lt;a href="https://errorsea.com/top-25-jquery-interview-questions/"&gt;Most Commonly Asked JQuery Interview Questions&lt;/a&gt;&lt;/p&gt;

</description>
      <category>jquery</category>
    </item>
    <item>
      <title>C++ Interview Questions</title>
      <dc:creator>Nachiket Panchal</dc:creator>
      <pubDate>Sun, 01 Mar 2020 12:52:56 +0000</pubDate>
      <link>https://dev.to/nachiket/c-interview-questions-1g3m</link>
      <guid>https://dev.to/nachiket/c-interview-questions-1g3m</guid>
      <description>&lt;p&gt;Q What is C++?&lt;/p&gt;

&lt;p&gt;Ans. It is an object-oriented programming language developed in 1985. Bjarne Stroustrup created it.&lt;/p&gt;

&lt;p&gt;C++ language is the updated version of C language with having classes and objects.&lt;/p&gt;

&lt;p&gt;It was called “C language with class”. After sometimes, it was known as C++ language.&lt;/p&gt;

&lt;p&gt;You can use &lt;a href="https://errorsea.com/download-and-install-turbo-c-for-windows-11/"&gt;Turbo C++&lt;/a&gt; to run C and C++ programs.&lt;/p&gt;

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