UNPKG

phpjs

Version:

php.js offers community built php functions in javascript

66 lines (54 loc) 1.79 kB
--- layout: page title: "JavaScript is_null function" comments: true sharing: true footer: true alias: - /functions/view/is_null:448 - /functions/view/is_null - /functions/view/448 - /functions/is_null:448 - /functions/448 --- <!-- Generated by Rakefile:build --> A JavaScript equivalent of PHP's is_null {% codeblock var/is_null.js lang:js https://raw.github.com/kvz/phpjs/master/functions/var/is_null.js raw on github %} function is_null (mixed_var) { // From: http://phpjs.org/functions // + original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net) // * example 1: is_null('23'); // * returns 1: false // * example 2: is_null(null); // * returns 2: true return (mixed_var === null); } {% endcodeblock %} - [Raw function on GitHub](https://github.com/kvz/phpjs/blob/master/functions/var/is_null.js) Please note that php.js uses JavaScript objects as substitutes for PHP arrays, they are the closest match to this hashtable-like data structure. Please also note that php.js offers community built functions and goes by the [McDonald's Theory](https://medium.com/what-i-learned-building/9216e1c9da7d). We'll put online functions that are far from perfect, in the hopes to spark better contributions. Do you have one? Then please just: - [Edit on GitHub](https://github.com/kvz/phpjs/edit/master/functions/var/is_null.js) ### Example 1 This code {% codeblock lang:js example %} is_null('23'); {% endcodeblock %} Should return {% codeblock lang:js returns %} false {% endcodeblock %} ### Example 2 This code {% codeblock lang:js example %} is_null(null); {% endcodeblock %} Should return {% codeblock lang:js returns %} true {% endcodeblock %} ### Other PHP functions in the var extension {% render_partial _includes/custom/var.html %}