Detailed explanation of php basic functions

墨辰丷
Release: 2023-03-28 06:00:01
Original
1132 people have browsed it

This article mainly introduces the detailed explanation of basic functions of PHP. Interested friends can refer to it. I hope it will be helpful to everyone.

Not much to say, as follows:

<?php
//生成随机数 和 时间函数
//echo rand();
//echo "<br>";
//echo rand(0,10);
//echo time();//时间戳
//2017-02-10 08:46:12
date_default_timezone_set("Asia/Shanghai");
//echo date("Y-m-d h:i:s");//默认转换当前时间
//echo date("Y-m-d h:i:s",&#39;1386688343&#39;);
//echo strtotime("2013-12-10 11:12:23");
//字符串的处理
$str = &#39;Hello World!!!&#39;;
//echo strlen($str);
//$str1=&#39;Abc&#39;;
//$str2=&#39;abc&#39;;
//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/", "数字", $str);
//var_dump($str4);
$str5 = preg_split("/\d/",$str);
var_dump($str5);
Copy after login

##The above is the entire content of this article, I hope it will be helpful to everyone learning helps.


Related recommendations:

PHP implementation of variable length parameter processingFunctionDetailed explanation

str_pad()FunctionUsage details in php

Encapsulates a function## that can obtain the text content of an element

#

The above is the detailed content of Detailed explanation of php basic functions. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template