怎么写成PHP函数
- JScript code
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->function decode(C) { var digi=16; var add= 10; var plus=7; var cha=36; var I = -1; var H = 0; var B = ""; var J = C.length; var G = C.charCodeAt(J - 1); C = C.substring(0, J - 1); J--; for (var E = 0; E = add) { D = D - plus } B += (D).toString(cha); if (D > H) { I = E; H = D } } var A = parseInt(B.substring(0, I), digi); var F = parseInt(B.substring(I + 1), digi); var L = (A + F - parseInt(G)) / 2; var K = (F - L) / 100000; L /= 100000; return { lat: K, lng: L }}document.write(decode('HHDFJGZVVIHIJG').lat+','+decode('HHDFJGZVVIHIJG').lng);
这个JS函数的功能。。。怎么用PHP写呀。。谢谢了,这个函数运行结果:39.09917,117.22348
------解决方案--------------------
直译即可
- PHP code
print_r(decode('HHDFJGZVVIHIJG'));function decode($C) { $digi = 16; $add = 10; $plus = 7; $cha = 36; $I = -1; $H = 0; $B = ""; $J = strlen($C); $G = ord($C{$J - 1}); $C = substr($C, 0, -1); $J--; for ($E = 0; $E = $add) { $D = $D - $plus; } $B .= base_convert($D, 10, $cha); if ($D > $H) { $I = $E; $H = $D; } } $A = base_convert(substr($B,0, $I), $digi, 10); $F = base_convert(substr($B, $I + 1), $digi, 10); $L = ($A + $F - $G) / 2; $K = ($F - $L) / 100000; $L /= 100000; return array( 'lat' => $K, 'lng' => $L);}<div class="clear"> </div>

Oracle数据库中的DECODE函数是一个非常常用的函数,它可以根据一个表达式的结果值在一组值中进行选择。DECODE函数的语法如下:DECODE(expression,search_value1,result1,search_value2,result2,...,default_result)其中,expression是要进行比较的表达式,s

Oracle中的DECODE函数是一种条件表达式,常用于在查询语句中根据不同的条件返回不同的结果。本文将详细介绍DECODE函数的语法、用法和示例代码。一、DECODE函数语法DECODE(expr,search1,result1[,search2,result2,...,default])expr:要进行比较的表达式或字段。search1,

在Golang中,经常会使用strconv库进行字符串和数字类型之间的转换。但是,如果在使用strconv.ParseInt函数时出现了"undefined:strconv.ParseInt"错误,那么就需要进行一些解决方法:确认是否导入了strconv包在Golang中,如果想要使用某个包中的函数或变量,就必须首先导入该包。因此,

PHP中var关键字的作用和示例在PHP中,var关键字用于声明一个变量。以前的PHP版本中,使用var关键字是声明成员变量的惯用方式,现在已经不再推荐使用。然而,在某些情况下,var关键字依然会被使用。var关键字主要用于声明一个局部变量,并且会自动将该变量标记为局部作用域。这意味着该变量仅在当前的代码块中可见,并且不能在其他函数或代码块中访问。使用var

音频输出和输入需要特定的驱动程序和服务才能在Windows11上按预期工作。这些有时最终会在后台遇到错误,从而导致音频问题,如无音频输出、缺少音频设备、音频失真等。如何修复在Windows11上没有响应的音频服务我们建议您从下面提到的修复开始,并逐步完成列表,直到您设法解决您的问题。由于Windows11上的多种原因,音频服务可能无法响应。此列表将帮助您验证和修复阻止音频服务在Windows11上响应的大多数问题。请按照以下相关部分帮助您完成该过程。方法一:重启音频服务您可能会遇

本篇文章给大家带来了关于JavaScript的相关知识,其中主要给大家介绍了var、let以及const的区别有哪些,还有ECMAScript 和 JavaScript的关系介绍,感兴趣的朋友一起来看一下吧,希望对大家有帮助。

如何使用golang中的strconv.ParseInt函数将字符串转换为整数,需要具体代码示例在golang中,strconv包提供了一系列将字符串转换为其他类型的函数。其中,strconv.ParseInt函数用于将字符串转换为整数类型。使用strconv包的ParseInt函数非常简单。下面以具体的代码示例来说明如何使用该函数实现字符串到整数的转换。首

Oracle中DECODE函数的基本用法解析在Oracle数据库中,DECODE函数是一种非常常用的函数,用于实现类似于多层if-else语句的逻辑判断和数值替换。DECODE函数的基本语法如下:DECODE(expr,search1,result1,search2,result2,...,default_result)其中参数含义如下:expr


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

SublimeText3 Linux new version
SublimeText3 Linux latest version

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function
