search
HomeWeb Front-endJS TutorialRelated tricks in JavaScript

Related tricks in JavaScript

Jun 05, 2018 pm 03:58 PM
js代码片段

这篇文章主要介绍了JavaScript 有用的代码片段和 trick的相关知识,非常不错,具有参考借鉴价值,需要的朋友可以参考下

浮点数取整

const x = 123.4545;
x >> 0; // 123
~~x; // 123
x | 0; // 123
Math.floor(x); // 123

注意:前三种方法只适用于32个位整数,对于负数的处理上和 Math.floor是不同的。

Math.floor(-12.53); // -13
-12.53 | 0; // -12

生成6位数字验证码

// 方法一
('000000' + Math.floor(Math.random() * 999999)).slice(-6);
// 方法二
Math.random().toString().slice(-6);
// 方法三
Math.random().toFixed(6).slice(-6);
// 方法四
'' + Math.floor(Math.random() * 999999);

16进制颜色代码生成

(function() {
 return '#'+('00000'+
 (Math.random()*0x1000000<<0).toString(16)).slice(-6);
})();

驼峰命名转下划线

&#39;componentMapModelRegistry&#39;.match(/^[a-z][a-z0-9]+|[A-Z][a-z0-9]*/g).join(&#39;_&#39;).toLowerCase(); // component_map_model_registry

url查询参数转json格式

// ES6
const query = (search = &#39;&#39;) => ((querystring = &#39;&#39;) => (q => (querystring.split(&#39;&&#39;).forEach(item => (kv => kv[0] && (q[kv[0]] = kv[1]))(item.split(&#39;=&#39;))), q))({}))(search.split(&#39;?&#39;)[1]);

// 对应ES5实现
var query = function(search) {
 if (search === void 0) { search = &#39;&#39;; }
 return (function(querystring) {
 if (querystring === void 0) { querystring = &#39;&#39;; }
 return (function(q) {
  return (querystring.split(&#39;&&#39;).forEach(function(item) {
  return (function(kv) {
   return kv[0] && (q[kv[0]] = kv[1]);
  })(item.split(&#39;=&#39;));
  }), q);
 })({});
 })(search.split(&#39;?&#39;)[1]);
};
query(&#39;?key1=value1&key2=value2&#39;); // es6.html:14 {key1: "value1", key2: "value2"}

获取URL参数

function getQueryString(key){
 var reg = new RegExp("(^|&)"+ key +"=([^&]*)(&|$)");
 var r = window.location.search.substr(1).match(reg);
 if(r!=null){
  return unescape(r[2]);
 }
 return null;
}

n维数组展开成一维数组

var foo = [1, [2, 3], [&#39;4&#39;, 5, [&#39;6&#39;,7,[8]]], [9], 10];
// 方法一
// 限制:数组项不能出现`,`,同时数组项全部变成了字符数字
foo.toString().split(&#39;,&#39;); // ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"]
// 方法二
// 转换后数组项全部变成数字了
eval(&#39;[&#39; + foo + &#39;]&#39;); // [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
// 方法三,使用ES6展开操作符
// 写法太过麻烦,太过死板
[1, ...[2, 3], ...[&#39;4&#39;, 5, ...[&#39;6&#39;,7,...[8]]], ...[9], 10]; // [1, 2, 3, "4", 5, "6", 7, 8, 9, 10]
// 方法四
JSON.parse(`[${JSON.stringify(foo).replace(/\[|]/g, &#39;&#39;)}]`); // [1, 2, 3, "4", 5, "6", 7, 8, 9, 10]
// 方法五
const flatten = (ary) => ary.reduce((a, b) => a.concat(Array.isArray(b) ? flatten(b) : b), []);
flatten(foo); // [1, 2, 3, "4", 5, "6", 7, 8, 9, 10]
// 方法六
function flatten(a) {
 return Array.isArray(a) ? [].concat(...a.map(flatten)) : a;

注:更多方法请参考《How to flatten nested array in JavaScript?》

日期格式化

// 方法一
function format1(x, y) {
 var z = {
 y: x.getFullYear(),
 M: x.getMonth() + 1,
 d: x.getDate(),
 h: x.getHours(),
 m: x.getMinutes(),
 s: x.getSeconds()
 };
 return y.replace(/(y+|M+|d+|h+|m+|s+)/g, function(v) {
 return ((v.length > 1 ? "0" : "") + eval(&#39;z.&#39; + v.slice(-1))).slice(-(v.length > 2 ? v.length : 2))
 });
}

format1(new Date(), &#39;yy-M-d h:m:s&#39;); // 17-10-14 22:14:41

// 方法二
Date.prototype.format = function (fmt) { 
 var o = {
 "M+": this.getMonth() + 1, //月份 
 "d+": this.getDate(), //日 
 "h+": this.getHours(), //小时 
 "m+": this.getMinutes(), //分 
 "s+": this.getSeconds(), //秒 
 "q+": Math.floor((this.getMonth() + 3) / 3), //季度 
 "S": this.getMilliseconds() //毫秒 
 };
 if (/(y+)/.test(fmt)){
 fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
 } 
 for (var k in o){
 if (new RegExp("(" + k + ")").test(fmt)){
  fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
 }
 }  
 return fmt;
}
new Date().format(&#39;yy-M-d h:m:s&#39;); // 17-10-14 22:18:17

特殊字符转义

function htmlspecialchars (str) {
 var str = str.toString().replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, &#39;"&#39;);
 return str;
}
htmlspecialchars(&#39;&jfkds<>&#39;); // "&jfkds<>"

动态插入js

function injectScript(src) {
 var s, t;
 s = document.createElement(&#39;script&#39;);
 s.type = &#39;text/javascript&#39;;
 s.async = true;
 s.src = src;
 t = document.getElementsByTagName(&#39;script&#39;)[0];
 t.parentNode.insertBefore(s, t);
}

格式化数量

// 方法一
function formatNum (num, n) {
 if (typeof num == "number") {
 num = String(num.toFixed(n || 0));
 var re = /(-?\d+)(\d{3})/;
 while (re.test(num)) num = num.replace(re, "$1,$2");
 return num;
 }
 return num;
}
formatNum(2313123, 3); // "2,313,123.000"
// 方法二
&#39;2313123&#39;.replace(/\B(?=(\d{3})+(?!\d))/g, &#39;,&#39;); // "2,313,123"
// 方法三
function formatNum(str) {
 return str.split(&#39;&#39;).reverse().reduce((prev, next, index) => {
 return ((index % 3) ? next : (next + &#39;,&#39;)) + prev
 });
}
formatNum(&#39;2313323&#39;); // "2,313,323"

身份证验证

function chechCHNCardId(sNo) {
 if (!this.regExpTest(sNo, /^[0-9]{17}[X0-9]$/)) {
 return false;
 }
 sNo = sNo.toString();

 var a, b, c;
 a = parseInt(sNo.substr(0, 1)) * 7 + parseInt(sNo.substr(1, 1)) * 9 + parseInt(sNo.substr(2, 1)) * 10;
 a = a + parseInt(sNo.substr(3, 1)) * 5 + parseInt(sNo.substr(4, 1)) * 8 + parseInt(sNo.substr(5, 1)) * 4;
 a = a + parseInt(sNo.substr(6, 1)) * 2 + parseInt(sNo.substr(7, 1)) * 1 + parseInt(sNo.substr(8, 1)) * 6;
 a = a + parseInt(sNo.substr(9, 1)) * 3 + parseInt(sNo.substr(10, 1)) * 7 + parseInt(sNo.substr(11, 1)) * 9;
 a = a + parseInt(sNo.substr(12, 1)) * 10 + parseInt(sNo.substr(13, 1)) * 5 + parseInt(sNo.substr(14, 1)) * 8;
 a = a + parseInt(sNo.substr(15, 1)) * 4 + parseInt(sNo.substr(16, 1)) * 2;
 b = a % 11;

 if (b == 2) {
 c = sNo.substr(17, 1).toUpperCase();
 } else {
 c = parseInt(sNo.substr(17, 1));
 }

 switch (b) {
 case 0:
  if (c != 1) {
  return false;
  }
  break;
 case 1:
  if (c != 0) {
  return false;
  }
  break;
 case 2:
  if (c != "X") {
  return false;
  }
  break;
 case 3:
  if (c != 9) {
  return false;
  }
  break;
 case 4:
  if (c != 8) {
  return false;
  }
  break;
 case 5:
  if (c != 7) {
  return false;
  }
  break;
 case 6:
  if (c != 6) {
  return false;
  }
  break;
 case 7:
  if (c != 5) {
  return false;
  }
  break;
 case 8:
  if (c != 4) {
  return false;
  }
  break;
 case 9:
  if (c != 3) {
  return false;
  }
  break;
 case 10:
  if (c != 2) {
  return false;
  };
 }
 return true;
}

测试质数

function isPrime(n) {
 return !(/^.?$|^(..+?)\1+$/).test(&#39;1&#39;.repeat(n))
}

统计字符串中相同字符出现的次数

var arr = &#39;abcdaabc&#39;;
var info = arr
 .split(&#39;&#39;)
 .reduce((p, k) => (p[k]++ || (p[k] = 1), p), {});
console.log(info); //{ a: 3, b: 2, c: 2, d: 1 }

使用 void0来解决 undefined被污染问题

undefined = 1;
!!undefined; // true
!!void(0); // false

单行写一个评级组件

"★★★★★☆☆☆☆☆".slice(5 - rate, 10 - rate);

JavaScript 错误处理的方式的正确姿势

try {
  something
} catch (e) {
  window.location.href =
    "http://stackoverflow.com/search?q=[js]+" +
    e.message;
}

匿名函数自执行写法

( function() {}() );
( function() {} )();
[ function() {}() ];
~ function() {}();
! function() {}();
+ function() {}();
- function() {}();
delete function() {}();
typeof function() {}();
void function() {}();
new function() {}();
new function() {};
var f = function() {}();
1, function() {}();
1 ^ function() {}();
1 > function() {}();

两个整数交换数值

var a = 20, b = 30;
a ^= b;
b ^= a;
a ^= b;
a; // 30
b; // 20

数字字符转数字

var a = &#39;1&#39;;
+a; // 1

最短的代码实现数组去重

[...new Set([1, "1", 2, 1, 1, 3])]; // [1, "1", 2, 3]

用最短的代码实现一个长度为m(6)且值都n(8)的数组

Array(6).fill(8); // [8, 8, 8, 8, 8, 8]

将argruments对象转换成数组

var argArray = Array.prototype.slice.call(arguments);

// ES6:
var argArray = Array.from(arguments)

// or
var argArray = [...arguments];

获取日期时间缀

// 获取指定时间的时间缀
new Date().getTime();
(new Date()).getTime();
(new Date).getTime();
// 获取当前的时间缀
Date.now();
// 日期显示转换为数字
+new Date();

使用 ~x.indexOf('y')来简化 x.indexOf('y')>-1

var str = &#39;hello world&#39;;
if (str.indexOf(&#39;lo&#39;) > -1) {
 // ...
}
if (~str.indexOf(&#39;lo&#39;)) {
 // ...
}

两者的差别之处在于解析和转换两者之间的理解。

解析允许字符串中含有非数字字符,解析按从左到右的顺序,如果遇到非数字字符就停止。而转换不允许出现非数字字符,否者会失败并返回NaN。

var a = &#39;520&#39;;
var b = &#39;520px&#39;;
Number(a); // 520
parseInt(a); // 520
Number(b); // NaN
parseInt(b); // 520

parseInt方法第二个参数用于指定转换的基数,ES5默认为10进制。

parseInt(&#39;10&#39;, 2); // 2
parseInt(&#39;10&#39;, 8); // 8
parseInt(&#39;10&#39;, 10); // 10
parseInt(&#39;10&#39;, 16); // 16

对于网上 parseInt(0.0000008)的结果为什么为8,原因在于0.0000008转换成字符为"8e-7",然后根据 parseInt的解析规则自然得到"8"这个结果。

+ 拼接操作,+x or String(x)?

+运算符可用于数字加法,同时也可以用于字符串拼接。如果+的其中一个操作符是字符串(或者通过 隐式强制转换可以得到字符串),则执行字符串拼接;否者执行数字加法。

需要注意的时对于数组而言,不能通过 valueOf()方法得到简单基本类型值,于是转而调用 toString()方法。

[1,2] + [3, 4]; // "1,23,4"

对于对象同样会先调用 valueOf()方法,然后通过 toString()方法返回对象的字符串表示。

var a = {};
a + 123; // "[object Object]123"

对于 a+""隐式转换和 String(a)显示转换有一个细微的差别: a+''会对a调用 valueOf()方法,而 String()直接调用 toString()方法。大多数情况下我们不会考虑这个问题,除非真遇到。

var a = {
 valueOf: function() { return 42; },
 toString: function() { return 4; }
}
a + &#39;&#39;; // 42
String(a); // 4

判断对象的实例

// 方法一: ES3
function Person(name, age) {
 if (!(this instanceof Person)) {
  return new Person(name, age);
 }
 this.name = name;
 this.age = age;
}
// 方法二: ES5
function Person(name, age) {
 var self = this instanceof Person ? this : Object.create(Person.prototype);
 self.name = name;
 self.age = age;
 return self;
}
// 方法三:ES6
function Person(name, age) {
 if (!new.target) {
  throw &#39;Peron must called with new&#39;;
 }
 this.name = name;
 this.age = age;
}

数据安全类型检查

// 对象
function isObject(value) {
 return Object.prototype.toString.call(value).slice(8, -1) === &#39;Object&#39;&#39;;
}
// 数组
function isArray(value) {
 return Object.prototype.toString.call(value).slice(8, -1) === &#39;Array&#39;;
}
// 函数
function isFunction(value) {
 return Object.prototype.toString.call(value).slice(8, -1) === &#39;Function&#39;;
}

让数字的字面值看起来像对象

toString(); // Uncaught SyntaxError: Invalid or unexpected token
..toString(); // 第二个点号可以正常解析
 .toString(); // 注意点号前面的空格
(2).toString(); // 2先被计算

对象可计算属性名(仅在ES6中)

var suffix = &#39; name&#39;;
var person = {
 [&#39;first&#39; + suffix]: &#39;Nicholas&#39;,
 [&#39;last&#39; + suffix]: &#39;Zakas&#39;
}
person[&#39;first name&#39;]; // "Nicholas"
person[&#39;last name&#39;]; // "Zakas"

数字四舍五入

// v: 值,p: 精度
function (v, p) {
 p = Math.pow(10, p >>> 31 ? 0 : p | 0)
 v *= p;
 return (v + 0.5 + (v >> 31) | 0) / p
}
round(123.45353, 2); // 123.45

在浏览器中根据url下载文件

function download(url) {
 var isChrome = navigator.userAgent.toLowerCase().indexOf(&#39;chrome&#39;) > -1;
 var isSafari = navigator.userAgent.toLowerCase().indexOf(&#39;safari&#39;) > -1;
 if (isChrome || isSafari) {
  var link = document.createElement(&#39;a&#39;);
  link.href = url;
  if (link.download !== undefined) {
   var fileName = url.substring(url.lastIndexOf(&#39;/&#39;) + 1, url.length);
   link.download = fileName;
  }
  if (document.createEvent) {
   var e = document.createEvent(&#39;MouseEvents&#39;);
   e.initEvent(&#39;click&#39;, true, true);
   link.dispatchEvent(e);
   return true;
  }
 }
 if (url.indexOf(&#39;?&#39;) === -1) {
  url += &#39;?download&#39;;
 }
 window.open(url, &#39;_self&#39;);
 return true;
}

快速生成UUID

function uuid() {
 var d = new Date().getTime();
 var uuid = &#39;xxxxxxxxxxxx-4xxx-yxxx-xxxxxxxxxxxx&#39;.replace(/[xy]/g, function(c) {
  var r = (d + Math.random() * 16) % 16 | 0;
  d = Math.floor(d / 16);
  return (c == &#39;x&#39; ? r : (r & 0x3 | 0x8)).toString(16);
 });
 return uuid;
};
uuid(); // "33f7f26656cb-499b-b73e-89a921a59ba6"

JavaScript浮点数精度问题

function isEqual(n1, n2, epsilon) {
 epsilon = epsilon == undefined ? 10 : epsilon; // 默认精度为10
 return n1.toFixed(epsilon) === n2.toFixed(epsilon);
}
0.1 + 0.2; // 0.30000000000000004
isEqual(0.1 + 0.2, 0.3); // true
0.7 + 0.1 + 99.1 + 0.1; // 99.99999999999999
isEqual(0.7 + 0.1 + 99.1 + 0.1, 100); // true

格式化表单数据

function formatParam(obj) {
 var query = &#39;&#39;, name, value, fullSubName, subName, subValue, innerObj, i;
 for(name in obj) {
  value = obj[name];
  if(value instanceof Array) {
   for(i=0; i<value.length; ++i) {
    subValue = value[i];
    fullSubName = name + &#39;[&#39; + i + &#39;]&#39;;
    innerObj = {};
    innerObj[fullSubName] = subValue;
    query += formatParam(innerObj) + &#39;&&#39;;
   }
  }
  else if(value instanceof Object) {
   for(subName in value) {
    subValue = value[subName];
    fullSubName = name + &#39;[&#39; + subName + &#39;]&#39;;
    innerObj = {};
    innerObj[fullSubName] = subValue;
    query += formatParam(innerObj) + &#39;&&#39;;
   }
  }
  else if(value !== undefined && value !== null)
   query += encodeURIComponent(name) + &#39;=&#39; + encodeURIComponent(value) + &#39;&&#39;;
 }
 return query.length ? query.substr(0, query.length - 1) : query;
}
var param = {
 name: &#39;jenemy&#39;,
 likes: [0, 1, 3],
 memberCard: [
  { title: &#39;1&#39;, id: 1 },
  { title: &#39;2&#39;, id: 2 }
 ]
}
formatParam(param); // "name=12&likes%5B0%5D=0&likes%5B1%5D=1&likes%5B2%5D=3&memberCard%5B0%5D%5Btitle%5D=1&memberCard%5B0%5D%5Bid%5D=1&memberCard%5B1%5D%5Btitle%5D=2&memberCard%5B1%5D%5Bid%5D=2"

创建指定长度非空数组

在JavaScript中可以通过new Array(3)的形式创建一个长度为3的空数组。在老的Chrome中其值为[undefined x 3],在最新的Chrome中为[empty x 3],即空单元数组。在老Chrome中,相当于显示使用[undefined, undefined, undefined]的方式创建长度为3的数组。

但是,两者在调用map()方法的结果是明显不同的

var a = new Array(3);
var b = [undefined, undefined, undefined];
a.map((v, i) => i); // [empty × 3]
b.map((v, i) => i); // [0, 1, 2]

多数情况我们期望创建的是包含undefined值的指定长度的空数组,可以通过下面这种方法来达到目的:

var a = Array.apply(null, { length: 3 });
a; // [undefined, undefined, undefined]
a.map((v, i) => i); // [0, 1, 2]

上面是我整理给大家的,希望今后会对大家有帮助。

相关文章:

如何关闭Vue计算属性自带的缓存功能,具体步骤有哪些?

如何解决vue 更改计算属性后select选中值不更改的问题,具体操作如下

如何解决iview 的select下拉框选项错位的问题,具体操作如下

The above is the detailed content of Related tricks in JavaScript. For more information, please follow other related articles on the PHP Chinese website!

Statement
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
The Origins of JavaScript: Exploring Its Implementation LanguageThe Origins of JavaScript: Exploring Its Implementation LanguageApr 29, 2025 am 12:51 AM

JavaScript originated in 1995 and was created by Brandon Ike, and realized the language into C. 1.C language provides high performance and system-level programming capabilities for JavaScript. 2. JavaScript's memory management and performance optimization rely on C language. 3. The cross-platform feature of C language helps JavaScript run efficiently on different operating systems.

Behind the Scenes: What Language Powers JavaScript?Behind the Scenes: What Language Powers JavaScript?Apr 28, 2025 am 12:01 AM

JavaScript runs in browsers and Node.js environments and relies on the JavaScript engine to parse and execute code. 1) Generate abstract syntax tree (AST) in the parsing stage; 2) convert AST into bytecode or machine code in the compilation stage; 3) execute the compiled code in the execution stage.

The Future of Python and JavaScript: Trends and PredictionsThe Future of Python and JavaScript: Trends and PredictionsApr 27, 2025 am 12:21 AM

The future trends of Python and JavaScript include: 1. Python will consolidate its position in the fields of scientific computing and AI, 2. JavaScript will promote the development of web technology, 3. Cross-platform development will become a hot topic, and 4. Performance optimization will be the focus. Both will continue to expand application scenarios in their respective fields and make more breakthroughs in performance.

Python vs. JavaScript: Development Environments and ToolsPython vs. JavaScript: Development Environments and ToolsApr 26, 2025 am 12:09 AM

Both Python and JavaScript's choices in development environments are important. 1) Python's development environment includes PyCharm, JupyterNotebook and Anaconda, which are suitable for data science and rapid prototyping. 2) The development environment of JavaScript includes Node.js, VSCode and Webpack, which are suitable for front-end and back-end development. Choosing the right tools according to project needs can improve development efficiency and project success rate.

Is JavaScript Written in C? Examining the EvidenceIs JavaScript Written in C? Examining the EvidenceApr 25, 2025 am 12:15 AM

Yes, the engine core of JavaScript is written in C. 1) The C language provides efficient performance and underlying control, which is suitable for the development of JavaScript engine. 2) Taking the V8 engine as an example, its core is written in C, combining the efficiency and object-oriented characteristics of C. 3) The working principle of the JavaScript engine includes parsing, compiling and execution, and the C language plays a key role in these processes.

JavaScript's Role: Making the Web Interactive and DynamicJavaScript's Role: Making the Web Interactive and DynamicApr 24, 2025 am 12:12 AM

JavaScript is at the heart of modern websites because it enhances the interactivity and dynamicity of web pages. 1) It allows to change content without refreshing the page, 2) manipulate web pages through DOMAPI, 3) support complex interactive effects such as animation and drag-and-drop, 4) optimize performance and best practices to improve user experience.

C   and JavaScript: The Connection ExplainedC and JavaScript: The Connection ExplainedApr 23, 2025 am 12:07 AM

C and JavaScript achieve interoperability through WebAssembly. 1) C code is compiled into WebAssembly module and introduced into JavaScript environment to enhance computing power. 2) In game development, C handles physics engines and graphics rendering, and JavaScript is responsible for game logic and user interface.

From Websites to Apps: The Diverse Applications of JavaScriptFrom Websites to Apps: The Diverse Applications of JavaScriptApr 22, 2025 am 12:02 AM

JavaScript is widely used in websites, mobile applications, desktop applications and server-side programming. 1) In website development, JavaScript operates DOM together with HTML and CSS to achieve dynamic effects and supports frameworks such as jQuery and React. 2) Through ReactNative and Ionic, JavaScript is used to develop cross-platform mobile applications. 3) The Electron framework enables JavaScript to build desktop applications. 4) Node.js allows JavaScript to run on the server side and supports high concurrent requests.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

MantisBT

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.

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment