Questions tagged as 'eval'


Is Eval good or bad guy?

They speak very poorly of eval , but sometimes I wonder if it really is the problem or it is the person who is sitting in front of the computer (I support the programmer). My entire life (in programming) I've heard criticisms, jokes, zo...
asked by 16.05.2016 / 22:38

Receive an expression and compute in C

I'm developing this program that should receive an expression from the user and do the calculation. Ex:    Enter an expression       3 * 5-1       14 My problem is how to handle the expression sent by the user. It was recommended to...
asked by 18.02.2014 / 20:22

What are the ways to apply eval in Javascript

There is more than one way to make a eval() in javascript, problem is that it can be a danger to the user if misused. Internally some other methods also make eval, for example setTimeout() that if put in the argument of callb...
asked by 08.02.2014 / 16:52

What is the difference between new Function and eval?

What is the difference between new Function and eval , since both seem to do the same thing? Example with eval : eval('1 + 1'); // 2 Example with new Function : new Function('', 'return (1+1)')() // 2     
asked by 29.07.2015 / 21:36

Why do we have to use it? ? php when we use eval in the contents of a php script?

I took a look at the source code of laravel 3 and saw the following code: eval('?>'.$__contents); On other occasions, I've seen something like: $content = file_get_contents('file.php'); eval('?>' . $content . '<?php'); Why do...
asked by 12.08.2015 / 16:21

Call one function inside the other, through a string

In order to make it easier for other programmers to default to , I have created a JavaScript library with some form field validation and formatting functions (date, telephone, CNPJ, etc.). At the end of the process, this library allowed me a...
asked by 31.03.2014 / 21:38

Javascript: why does eval ("023") return 19? [duplicate]

I know that the function should not be used indiscriminately, because it has several security implications, as can be seen here: Is Eval a Good Guy or a Bandit? But I was doing a simple calculator, where the text of the input, after tr...
asked by 28.03.2017 / 19:04

Dynamically execute a class model method from an ajax request for the controller

I'm creating a feature on my system for reloading components dynamically so that queries are executed that are allocated to model-layer classes through AJAX requests. However, as I use the MVC standard from the CodeIgniter framework, every reque...
asked by 05.01.2015 / 13:15

Structure for PHP project and use of the eval () function

I need to develop an application that fits with several projects with common features, however each one has several specific rules. What I need is a structure that allows me to easily change these rules, in case I chose to save the rules in t...
asked by 03.08.2015 / 18:10

How to display alert after error of an eval ()?

I have a calculator that works something like this: [bolas][+][preco da bola] I scan the string by replacing [XXXXXXX] with the corresponding value and use eval to perform the calculation. But there may be cases of error when for example th...
asked by 06.02.2015 / 20:09