摘要: 和JS 中的JOIN 方法一样,将一数组按照JOIN的参数连接起来。比如:var arr = [ "a", "b", "c", "d", "e" ];document.write(arr.join("-"));结果:a-b-c-d-e。var members=["John","Steve","Ben","Damon","Ian"];$('p.allmem').h 阅读全文
posted @ 2012-07-03 17:46 TBHacker 阅读(51624) 评论(1) 推荐(0) 编辑
摘要: 1.遍历字符串<?php$string = "This weekend,I'm going shopping for a pet chicken.";$vowels = 0;for($i = 0,$j = strlen($string);$i<$j;$i++){ if(strstr('aeiouAEIOU',$string[$i])){ $vowels++; }}echo $vowels;?>输出结果:14。遍历字符串,获得其中所有的元音字母个数,这里的strstr(para1,para2)方法可以判断参数para2是否在para1 阅读全文
posted @ 2012-07-03 11:57 TBHacker 阅读(522) 评论(0) 推荐(0) 编辑