发表时间:2015-05-27来源:网络
| 12345678910111213141516171819202122232425262728 |
function getDistanceBetweenPointsNew($latitude1, $longitude1, $latitude2, $longitude2) { $theta = $longitude1 - $longitude2; $miles = (sin(deg2rad($latitude1)) * sin(deg2rad($latitude2))) + (cos(deg2rad($latitude1)) * cos(deg2rad($latitude2)) * cos(deg2rad($theta))); $miles = acos($miles); $miles = rad2deg($miles); $miles = $miles * 60 * 1.1515; $feet = $miles * 5280; $yards = $feet / 3; $kilometers = $miles * 1.609344; $meters = $kilometers * 1000; return compact('miles','feet','yards','kilometers','meters');} $point1 = array('lat' => 40.770623, 'long' => -73.964367);$point2 = array('lat' => 40.758224, 'long' => -73.917404);$distance = getDistanceBetweenPointsNew($point1['lat'], $point1['long'], $point2['lat'], $point2['long']);foreach ($distance as $unit => $value) { echo $unit.': '.number_format($value,4).'';} The example returns the following: miles: 2.6025feet: 13,741.4350yards: 4,580.4783kilometers: 4.1884meters: 4,188.3894
|
| 12345678910111213141516171819202122232425 |
function xcurl($url,$ref=null,$post=array(),$ua="Mozilla/5.0 (X11; Linux x86_64; rv:2.2a1pre) Gecko/20110324 Firefox/4.2a1pre",$print=false) { $ch = curl_init(); curl_setopt($ch, CURLOPT_AUTOREFERER, true); if(!empty($ref)) { curl_setopt($ch, CURLOPT_REFERER, $ref); } curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); if(!empty($ua)) { curl_setopt($ch, CURLOPT_USERAGENT, $ua); } if(count($post) > 0){ curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $post); } $output = curl_exec($ch); curl_close($ch); if($print) { print($output); } else { return $output; }}
|
| 123456789101112131415161718192021222324 |
]*?>.*?@si', // Strip out javascript '@]*?>@si', // Strip out HTML tags '@]*?>.*?@siU', // Strip style tags properly '@@' // Strip multi-line comments ); $output = preg_replace($search, '', $input); return $output; }?>$val) { $output[$var] = sanitize($val); } } else { if (get_magic_quotes_gpc()) { $input = stripslashes($input); } $input = cleanInput($input); $output = mysql_real_escape_string($input); } return $output;}?>
|
| 1234567891011121314151617181920212223242526272829303132 |
function detect_city($ip) { $default = 'Hollywood, CA'; if (!is_string($ip) || strlen($ip)
|
| 12345678910111213141516171819 |
100){ $strength = 100; } return $strength;} var_dump(password_strength("Correct Horse Battery Staple"));echo "";var_dump(password_strength("Super Monkey Ball"));echo "";var_dump(password_strength("Tr0ub4dor&3"));echo "";var_dump(password_strength("abc123"));echo "";var_dump(password_strength("sweet"));
|
| 12345678910111213141516171819 |
function get_client_language($availableLanguages, $default='en'){ if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { $langs=explode(',',$_SERVER['HTTP_ACCEPT_LANGUAGE']); //start going through each one foreach ($langs as $value){ $choice=substr($value,0,2); if(in_array($choice, $availableLanguages)){ return $choice; } } } return $default;}
|
| 12345 |
function data_uri($file, $mime) { $contents=file_get_contents($file); $base64=base64_encode($contents); echo "data:$mime;base64,$base64";}
|
| 123 |
function make_seo_name($title) { return preg_replace('/[^a-z0-9_-]/i', '', strtolower(str_replace(' ', '-', trim($title))));}
|
| 12345678910111213141516171819 |
// f(ucking) u(ncrackable) e(ncryption) function by BlackHatDBL (www.netforme.net)function fue($hash,$times) { // Execute the encryption(s) as many times as the user wants for($i=$times;$i>0;$i--) { // Encode with base64... $hash=base64_encode($hash); // and md5... $hash=md5($hash); // sha1... $hash=sha1($hash); // sha256... (one more) $hash=hash("sha256", $hash); // sha512 $hash=hash("sha512", $hash); } // Finaly, when done, return the value return $hash;}
|
| 12345678910111213141516171819202122232425262728 |
pversion; } public function loadTimeline($user, $max = 20){ $this->twitURL .= 'statuses/user_timeline.xml?screen_name='.$user.'&count='.$max; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $this->twitURL); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $this->xml = curl_exec($ch); return $this; } public function getTweets(){ $this->twitterArr = $this->getTimelineArray(); $tweets = array(); foreach($this->twitterArr->status as $status){ $tweets[$status->created_at->__toString()] = $status->text->__toString(); } return $tweets; } public function getTimelineArray(){ return simplexml_load_string($this->xml); } public function formatTweet($tweet){ $tweet = preg_replace("/(http(.+?))( |$)/","$1$3", $tweet); $tweet = preg_replace("/#(.+?)(/h|/W|$)/", "#$1$2", $tweet); $tweet = preg_replace("/@(.+?)(/h|/W|$)/", "@$1$2", $tweet); return $tweet; }}
|
| 1234 |
loadTimeline("phpsnips")->getTweets();foreach($feed as $time => $message){ echo ";}
|
上一篇:php 这样做优化
CI框架连接数据库配置操作以及多数据库操作
asp 简单读取数据表并列出来 ASP如何快速从数据库读取大量数据
C语言关键字及其解释介绍 C语言32个关键字详解
C语言中sizeof是什么意思 c语言里sizeof怎样用法详解
PHP中的魔术方法 :__construct, __destruct , __call, __callStatic,__get, __set, __isset, __unset , __sleep,
PHP中的(++i)前缀自增 和 (i++)后缀自增
将视频设置为Android手机开机动画的教程
最简单的asp登陆界面代码 asp登陆界面源代码详细介绍
常用dos命令及语法
PHP中include和require区别之我见
华为智能光伏官方版(FusionSolar)下载v25.3.101.001 安卓版
130.65MB |商务办公
PETKIT小佩宠物官方软件下载v13.1.1 安卓版
300.76MB |系统工具
分包管家app下载v3.7.3 安卓版
58.74MB |商务办公
tplink物联监控摄像头app下载v5.10.5.1681 安卓版
94.39M |社交娱乐
tplink无线摄像头软件(改名tplink物联)下载v5.11.21.1795 安卓手机客户端
94.93MB |系统工具
多屏互动软件下载v10.1.2471 安卓最新版本
108.16MB |系统工具
朴朴森山官方版下载v1.3.3 安卓版
26.43MB |商务办公
aik钥匙工具app下载v2.7.0 安卓版
82.46M |系统工具
2014-09-05
2022-03-20
2022-03-21
2022-03-24
2014-09-05
2014-09-05
2015-07-05
2014-09-05
2022-03-21
2014-09-05