Tutorialspoint

Execute PHP Online

php

</php
echo stristr("Demo text!","TEXT",true);
?>

strcasecmp() function in PHP example 2

php

<?php
   $val1 = "Tom";
   $val2 = "tom";
   if (strcasecmp($val1, $val2) == 0) {
      echo '$va11 is equal to $val2';
   }
?>

PHP quotemeta() function

php

<?php 
   $str = "3 * 9 = 27";
   echo quotemeta($str); 
?>

PHP htmlspecialchars decode() function

php

<?php
$s = "<p>this -&gt; &quot;keyword in programming language</p>\n";
echo htmlspecialchars_decode($s);
echo htmlspecialchars_decode($s, ENT_NOQUOTES);
?>

PHP count chars() function

php

<?php
   $s = "Weclome!";
   print_r(count_chars($s,1));
?>

PHP timezone_abbreviations

php

<?php
   $res = timezone_abbreviations_list();
   print_r($res["act"]);
?>

PHP timezone_abbreviations_list() function

php

<?php
   $timezone_abbreviations = timezone_abbreviations_list (); 
   print_r($timezone_abbreviations["acst"]); 
   echo "----------------------------------------------\n"; 
   # Using second function. 
   $timezone_abbreviations = DateTimeZone::listAbbreviations(); 
   print_r($timezone_abbreviations["acst"]);
?>

PHP ctype_cntrl() function

php

<?php
   $arr = array('str1' =>"\n\r\t", 'str2' =>"demo76876test"); 
   foreach ($arr as $a => $demo) { 
      if (ctype_cntrl($demo)) { 
         echo "$a has all control characters. \n"; 
      }else { 
         echo "$a does not have all control characters. \n"; 
      } 
   }
?>   

PHP ctype_print() function

php

<?php
   $arr = array('asdf\n\r\t', 'yu67', "fooo#int%@");
   foreach ($arr as $x) {
      if (ctype_print($x)) {
         echo "$x has all printable characters. \n";
      }else {
         echo "$x does not have all printable characters. \n";
      }
   }
?>

PHP ctype_graph() function

php

<?php
   $arr = array('khy\n\r\t', 'arf12', 'LKA#@%.54');
   foreach ($arr as $demo) {
      if (ctype_graph($demo)) {
         echo "$demo consists of all (visibly) printable characters \n";
      }else {
         echo "$demo does not have all (visibly) printable characters. \n";
      }
   }
?>

1 2 3 4 5 6 7 ... 1808 Next
Advertisements
Loading...