From 838e12d3929bdc34b7da9ca51d05eb2adbd85a72 Mon Sep 17 00:00:00 2001 From: erikn69 Date: Wed, 28 Sep 2022 16:49:00 -0500 Subject: [PATCH] Small fixes PHP funtcions --- src/PHP_CoreFunctions.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/PHP_CoreFunctions.js b/src/PHP_CoreFunctions.js index 5a5c4d4..5cd5386 100644 --- a/src/PHP_CoreFunctions.js +++ b/src/PHP_CoreFunctions.js @@ -182,11 +182,7 @@ const rtrim = (str, chars = ' ') => { }; -const explode = (search, from) => { - - return from.split(search) - -} +const explode = (search, from) => { return `${from}`.split(`${search}`) } const hexdec = (hexString) => { // discuss at: https://locutus.io/php/hexdec/ @@ -237,8 +233,11 @@ const fseek = (f,n,position='SEEK_CUR') =>{ return read } -const file_get_contents = ()=>{ +const file_exists = (filename)=>{ return fs.existsSync(filename) } +const file_get_contents = (filename)=>{ + // discuss at: https://locutus.io/php/file_get_contents/ + return fs.readFileSync(filename, 'utf-8') } const strtr = (str, from, to) => { @@ -731,6 +730,7 @@ module.exports = { fclose, fread, fseek, + file_exists, file_get_contents, strtr, array_keys,