Tutorialspoint

filter_list() function in PHP

<?php
foreach (filter_list() as $id => $filter) {
   echo '<tr><td>' . $filter . '</td><td>' . filter_id($filter) . '</td></tr>';
}
?>

PHP Function date_date_set()

<?php
   $dateSrc = '2005-04-19 12:50 GMT';
   $dateTime = date_create( $dateSrc);;
   # Now set a new date using date_date_set();
   date_date_set( $dateTime, 2000, 12, 12);
   
   echo "New Formatted date is ". $dateTime->format("Y-m-d\TH:i:s\Z");
   echo "<br />";

   # Using second function.
   $dateTime = new DateTime($dateSrc);
   $dateTime->setDate( 1999, 10, 12);
   
   echo "New Formatted date is ". $dateTime->format("Y-m-d\TH:i:s\Z");
?>

usort() php program

<?php
   function cmp_function($a, $b) {
      if ($a == $b) return 0;
      return ($a > $b) ? -1 : 1;
   }
   
   $fruits = array("d"=>"lemon", "a"=>"orange", "b"=>"banana" );
   usort($fruits, "cmp_function");
   
   print_r($fruits);
?> 

Function array_uintersect_uassoc() php program

<?php
   $input1 = array("a"=>"green", "b"=>"brown", "c"=>"blue", "red");
   $input2 = array("a"=>"GREEN", "B"=>"brown", "yellow", "red");
   
   print_r(array_uintersect_uassoc($input1, $input2, "strcasecmp", "strcasecmp"));
?> 

PHP Function array_merge()

<?php
   $input = array("a"=>"Horse","b"=>"Cat","c"=>"Dog");
   $input1 = array("d"=>"Cow","a"=>"Cat","e"=>"elephant");
   
   print_r(array_merge($input,$input1));
?> 

PHP preg_quote() program

<?php
   $keywords = '$40 for a g3/400';
   $keywords = preg_quote($keywords, '/');
   
   echo $keywords;
?>

Php Multiple Arrays

<?php
   function call_back_func($v1, $v2) {
      if ($v1 === $v2) {
         return "equal";
      }
      return "different";
   }
   
   $array1 = array(1, 2, 3, 4);
   $array2 = array(10, 2, 30, 4);
   $b = array_map("call_back_func", $array1, $array2);
   
   print_r($b);

?>

PHP Function Str Ireplace

<?php
   $input = array("tutorials","point","simply","easy","learning");
   print_r(str_ireplace("simply","tutorials",$input,$i)); // Case-insensitive
   
   echo "<br>" . "Replacements: $i";  
?>

PHP Function chr split

<?php
   $str = "tutorialspoint";
   
   echo chunk_split($str,1,".");
?>

PHP Function trigger_error()

<?php
 if ($test<10) {
    trigger_error("Number cannot be less than 10");
}
?>

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

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.