Есть ли способ конвертировать javascript в php?Php

Кемеровские программисты php общаются здесь
Anonymous
Есть ли способ конвертировать javascript в php?

Сообщение Anonymous »


I was working on a project using laravel as my framework, Last week I was on vacation and came back to the project having a bunch (hundreds of lines) of javascript written into it by another student. It in theory works with the javascript but id want to convert it to php. Is there any way to do this? Or do I have to just write it all manually and find new ways to replicate the functions written in javascript using php?

The javascript looks like this and this is just a small part of it, this is a view of mine, not a controller and thats a big issue too and I dont think this is a very secure solution either compared to using laravel as supposed to? `function readApts(aptBlocks, logsheetID){ const fnl = { logsheet: logsheetID, currentaptblock: 0, currentapt: 0, currentsocket: 1, apts: [] };

aptBlocks.split(',').forEach((apt, index) => { //Splits the given blocks into a list on every , and does a foreach on all of them // NN const out = { block: apt, apt: [] }; const aptsInput = document.querySelector(`#apartmentBlock${index}`).value.replace(/\s+/g, ''); //Reads the specific apartment input and removes all spaces in it // NN if(aptsInput){ //If the input actually has any data in it // NN const res = []; aptsInput.split(',').forEach((apt) => { //Splits each apartment number input into a list on every , and does a foreach on each number // NN if(apt.includes('-')){ const [start, end] = apt.split('-'); //Splits the element into 2 if it has a - // NN for(let i = Number(start); i

Источник: https://stackoverflow.com/questions/780 ... t-into-php

Вернуться в «Php»