phpjs
Version:
49 lines (42 loc) • 1.64 kB
Markdown
layout: page
title: "JavaScript error_reporting function"
comments: true
sharing: true
footer: true
alias:
- /functions/view/error_reporting:841
- /functions/view/error_reporting
- /functions/view/841
- /functions/error_reporting:841
- /functions/841
<!-- Generated by Rakefile:build -->
A JavaScript equivalent of PHP's error_reporting
{% codeblock errorfunc/error_reporting.js lang:js https://raw.github.com/kvz/phpjs/master/functions/errorfunc/error_reporting.js raw on github %}
function error_reporting (level) {
// http://kevin.vanzonneveld.net
// + original by: Brett Zamir (http://brett-zamir.me)
// - depends on: ini_set
// % note 1: This will not set a global_value or access level for the ini item
// % note 2: If you wish the default value to be as in PHP, you must manually set it
// % note 3: This function depends on functions implementing error handling
// % note 4: See also our at() error suppressor function (@ operator in PHP) in experimental/language/
// * example 1: error_reporting(1);
// * returns 1: 6135
return this.ini_set('error_reporting', level);
}
{% endcodeblock %}
- [view on github](https://github.com/kvz/phpjs/blob/master/functions/errorfunc/error_reporting.js)
- [edit on github](https://github.com/kvz/phpjs/edit/master/functions/errorfunc/error_reporting.js)
### Example 1
This code
{% codeblock lang:js example %}
error_reporting(1);
{% endcodeblock %}
Should return
{% codeblock lang:js returns %}
6135
{% endcodeblock %}
### Other PHP functions in the errorfunc extension
{% render_partial _includes/custom/errorfunc.html %}