⊗ppPmCdExSCC 107 of 447 menu

Checking a String Character in PHP

Let there be a given string consisting of digits:

<?php $str = '12345'; ?>

Let's check if the first character of this string is equal to the number 1:

<?php $str = '12345'; if ($str[0] == 1) { echo '!'; } ?>

Now let's check if the last character is equal to the number 5:

<?php $str = '12345'; $last = $str[-1]; if ($last == 5) { echo '!'; } ?>

A certain string is given. Check if it ends with '0'.

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