Php udf & amp; array, php UDF

Source: Internet
Author: User
Tags echo date

PHP udfs & arrays, php udfs

<? Php
// Generate random numbers and Time Functions
// Echo rand ();
// Echo "<br> ";
// Echo rand (0, 10 );
// Echo time (); // Timestamp
// 08:46:12
Date_default_timezone_set ("Asia/Shanghai ");

// Echo date ("Y-m-d h: I: s"); // converts the current time by default.
// Echo date ("Y-m-d h: I: s", '20140901 ');
// Echo strtotime ("11:12:23 ");
// String processing
// $ Str = 'Hello World !!! ';
// Echo strlen ($ str );
// $ Str1 = 'abc ';
// $ Str2 = 'abc ';
// Echo strcmp ($ str1, $ str2 );
// Echo strcasecmp ($ str1, $ str2 );
// Echo strtoupper ($ str2 );
// Echo strtolower ($ str1 );

// $ Str = "a | B | c | d ";

// $ Str1 = explode ("|", $ str );
// Echo implode ("&", $ str1 );

// Echo substr ($ str, 1, 3 );
// Echo str_replace ("|", "&", $ str );
// Echo substr_replace ($ str, "%", 1, 1 );
// $ Str = "hello3 world4 ashdf223sdfa2323sd45454 ";
// Preg_match ("/\ d/", $ str, $ str2 );
// Preg_match_all ("/\ d/", $ str, $ str3 );
// Var_dump ($ str3 );
// $ Str4 = preg_replace ("/\ d/", "Number", $ str );
// Var_dump ($ str4 );
// $ Str5 = preg_split ("/\ d/", $ str );
// Var_dump ($ str5 );
// Function hansm ($ v)
//{
// $ V ++;
// Return $ v;
//}
// $ Temp = hansm (5 );
// Echo $ temp;
// Function test ($ a, $ B = 3)
//{
// Return $ a + $ B;
//}
//
// Echo test (2, 4 );
// Function test2 ()
//{
// $ Arr = func_get_args ();
// Return $ arr;
//}
// Var_dump (test2 (2, 3 ));
// $ Arr = array ();
// Var_dump ($ arr );

$ Arr = array ('x', 'y', 34 );

$ Arr2 = array (
'X' => 'A ',
'Y' => 'B ',
'Z' => 'C ',
9 => 35
);
// $ Arr_merge = array_merge ($ arr, $ arr2 );
// Var_dump ($ arr_merge );
// Echo $ arr2 [2];
// Var_dump ($ arr2 );
// Array_push ($ arr2, 'xxx ');
// Var_dump ($ arr2 );
// Var_dump (in_array ('V', $ arr2 ));
// $ Arr_reverse = array_reverse ($ arr2 );
// Var_dump ($ arr_reverse );
// Unset ($ arr2 );
// $ Ar2 = null;
// Var_dump ($ arr2 );
// For ($ I = 0; $ I <count ($ arr2); $ I ++)
//{
//
//}
Foreach ($ arr2 as $ k)
{
Var_dump ($ v );
}
Foreach ($ arr2 as $ k =>v v ){
Var_dump ($ arr2 [$ k]);
}
// Echo $ v;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.