Blogger Information
Blog 13
fans 0
comment 0
visits 5506
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
4.18 PHP数组函数 字符串函数 作业
安之若素
Original
546 people have browsed it

实例

<?php
echo '<h4 align="center">数组函数总结</h4>';
// 1.正序:sort() asort()数组的值的排序 ksort 数组的键名排序
// 2.反转:rsort()大到小  rasort() krsort
$sste=array('id'=>7,'age'=>29,'city'=>'厦门','name'=>'xiaoxi','8'=>true);
echo'<pre>';
print_r($sste);
echo'<hr color="#009900">';
//正序键名重置
//sort($srr,flog)按数据类型分组 在按自然排序
//sort($arr,SORT_NUMERIC)数字
//sort($arr,SORT_STRING)字符串 ASCII排序;
//sort($sste);
//print_r($sste);
//echo'<hr color="#009900">';
//asort()忽略类型 按自然排序
//ksort()按字母排序
ksort($sste);
print_r($sste);
echo '<hr corol=green>';
echo '<h4 align="center">字符串长度</h4>';
$encoding=mb_internal_encoding();
//字节计算长度
$str1='php.cn中文网';
echo strlen($str1);
echo '<hr color="#00FF00">';
//字符数长度
echo mb_strlen($str1,$encoding);
echo '<hr color="#00FF00">';
//str_split($srr,$strleng)
//explode($delimter,$str,$num)
//implode

$str='html,javascirpt,css,thinkphp,jquery';
echo '<pre>';
echo $str;
//echo'<hr color="#00FF00">';
//print_r(str_split($str,4));
//echo'<hr color="#00FF00">';
//print_r(explode(',',$str,4));
echo'<hr color="#00FF00">';
$arr = explode(',',$str);
print_r($arr);
echo implode('*',$arr);
?>

运行实例 »

点击 "运行实例" 按钮查看在线实例


Correction status:qualified

Teacher's comments:
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post