⊗ppSpAiMGP 44 of 83 menu

API with Multiple GET Parameters in PHP

Now let's assume that not one parameter, but several will be passed. For example, two numbers:

http://api.loc/index.php?num1=1&num2=100

Let's return a random number in the range from the first passed number to the second one:

<?php if (isset($_GET['num1']) and isset($_GET['num2'])) { echo mt_rand($_GET['num1'], $_GET['num2']); } else { echo 'error'; } ?>

Create an API with an address, to which two parameters will be passed: dates in the format year-month-day, and in response the number of days between these dates will be returned.

Modify the previous task so that a check for the correct date format is performed.

English
AfrikaansAzərbaycanБългарскиবাংলাБеларускаяČeštinaDanskDeutschΕλληνικάEspañolEestiSuomiFrançaisहिन्दीMagyarՀայերենIndonesiaItaliano日本語ქართულიҚазақ한국어КыргызчаLietuviųLatviešuМакедонскиMelayuမြန်မာNederlandsNorskPolskiPortuguêsRomânăРусскийසිංහලSlovenčinaSlovenščinaShqipСрпскиSrpskiSvenskaKiswahiliТоҷикӣไทยTürkmenTürkçeЎзбекOʻzbekTiếng Việt
We use cookies for website operation, analytics, and personalization. Data processing is carried out in accordance with the Privacy Policy.
accept all customize decline