UNPKG

phpjs

Version:

php.js offers community built php functions in javascript

54 lines (44 loc) 1.53 kB
--- layout: page title: "JavaScript feof function" comments: true sharing: true footer: true alias: - /functions/view/feof:772 - /functions/view/feof - /functions/view/772 - /functions/feof:772 - /functions/772 --- <!-- Generated by Rakefile:build --> A JavaScript equivalent of PHP's feof {% codeblock filesystem/feof.js lang:js https://raw.github.com/kvz/phpjs/master/functions/filesystem/feof.js raw on github %} function feof (handle) { // http://kevin.vanzonneveld.net // + original by: Brett Zamir (http://brett-zamir.me) // * example 1: var handle = fopen('http://kevin.vanzonneveld.net/pj_test_supportfile_1.htm', 'r'); // * example 1: fread(handle, 1); // * example 1: feof(handle); // * returns 1: false if (!handle || !this.php_js || !this.php_js.resourceData || !this.php_js.resourceDataPointer) { return true; } return !this.php_js.resourceData[handle.id][this.php_js.resourceDataPointer[handle.id]]; } {% endcodeblock %} - [view on github](https://github.com/kvz/phpjs/blob/master/functions/filesystem/feof.js) - [edit on github](https://github.com/kvz/phpjs/edit/master/functions/filesystem/feof.js) ### Example 1 This code {% codeblock lang:js example %} var handle = fopen('http://kevin.vanzonneveld.net/pj_test_supportfile_1.htm', 'r'); fread(handle, 1); feof(handle); {% endcodeblock %} Should return {% codeblock lang:js returns %} false {% endcodeblock %} ### Other PHP functions in the filesystem extension {% render_partial _includes/custom/filesystem.html %}