Most voted "eval" questions
Eval is a command that allows you to interpret a code/expression given by a string (text) causing it to be executed as part of the code.
Learn more…26 questions
Sort by count of
-
46
votes5
answers9524
viewsReceive an expression and calculate in C
I am developing this program that should receive an expression from the user and do the calculation. Ex: Insert an expression 3*5-1 14 My problem is how to handle the user-sent expression. I was…
-
40
votes2
answers1642
viewsIs Eval a good guy or a bad guy?
They talk a lot about eval, but sometimes I wonder if he really is the problem or is the person sitting in front of the computer (the supposed programmer). My whole life (in programming) I have…
evalasked 8 years, 6 months ago Wallace Maxters 102,340 -
25
votes3
answers9448
viewsJavascript use of Eval(): what are the pros and cons?
Recently I met this function and I was surprised by its power, it was of great use to me, but after using it I heard comments that it was not safe. I would like to know in situation this use can…
-
17
votes3
answers1400
viewsWhat are the ways to apply Eval in Javascript
There is more than one way to make one eval() in javascript, problem is that it can be a danger for the user if misused. Internally some other methods also do Val, for example the setTimeout() which…
-
8
votes4
answers37227
viewsCalling one function inside the other, through a string
To facilitate the work of other programmers in the company whose default is no pattern, i created a Javascript library with some form field formatting and validation functions (date, phone, CPF,…
-
8
votes2
answers528
viewsWhat is the difference between new Function and Eval?
What’s the difference between new Function and eval, since the two seem to be doing the same thing? Example with eval: eval('1 + 1'); // 2 Example with new Function: new Function('', 'return…
-
7
votes2
answers1636
viewsWhy do we have to use ? > <?php when we use Eval in the content 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');…
-
5
votes0
answers56
viewsJavascript: why does Eval("023") return 19?
I know that the function should not be used indiscriminately, because it has several security implications, conforms can be seen here: Eval is either good or bad? But I was making a simple…
-
4
votes2
answers1833
viewsDynamically execute model class method from an ajax request to the controller
I am creating a feature in my system for dynamic component reloading, so that queries are executed that are allocated in model layer classes, through AJAX requests. However, since I use the MVC…
-
4
votes1
answer362
viewsStructure for PHP project and use of the Eval() function
I need to develop an application that fits several projects with common functionalities, however each has several specific rules. What I need is a structure that allows me to easily change these…
-
4
votes1
answer266
viewsHow to execute arbitrary code in Python?
I use an xbase language that has macro substitution as in the original Clipper. Is there anything equivalent in Python? We use a lot of command line assembly via menus at runtime. For example,…
-
3
votes2
answers72
viewsHow to display alert after Eval() error?
I have a calculator that works more or less like this: [bolas][+][preco da bola] I see the string replacing [XXXXXXX] with the corresponding value and use Eval to perform the calculation. But there…
-
2
votes1
answer238
viewsEval() PHP, usability and context
I was reading some code e-commerce extensions. Normally these modules are paid, but what I was seeing had a trial to try. I installed and went to analyze the code. I was expecting something in PHP…
-
2
votes1
answer119
views -
2
votes3
answers214
viewsJavascript Check if it is safe
I would like to create sequenced objects and to set the name of the object, I could only do by function eval(), I found no other alternatives. They say it is unscrupulous, and subject to attacks. I…
-
1
votes1
answer1218
viewsHow to put " in a String?
I’m trying to evaluate a PHP code using Java, for that I need to replace in the code all " for \". The problem is that Java also has this escape character to put " in a String. Told me to use \\",…
-
1
votes1
answer112
viewsHow to transform a text into an identifier name?
I would like to be able to receive a string as a parameter and use as an identifier name, create a variable or function with that name (it is not used as a dictionary key). It is possible to do…
-
1
votes0
answers37
viewsJavascript eval. Why is it insecure?
Well, I was reading about eval Javascript and I came across a lot of questions in my brain in which it involves about it being insecure and scope. Because he is insecure? Why is considered a third…
-
1
votes1
answer73
viewsUse of Eval to transform Razor to Javascript
Before criticizing the use of eval, I read and recommend that answer. Take into account the following context: Code C# (Razor): var teste = new { prop1 = 123, prop2 = "minha mãe disse 'Háaaaaa!'" };…
-
1
votes2
answers138
viewsHow to be more cautious when using the Eval function?
I have a function that gets an account and calculates it using the function eval. My question is, how can I be more cautious in using this function ? def calcula(string): if type(eval(string)) in…
-
1
votes0
answers60
viewsHow to decrypt encrypted code with JS Eval Function in bulk
Hello would like to know how I can massively decrypt encrypted codes with JS Eval Function, I am with an encryptor and decrypter that performs the process perfectly with everything I am requiring…
-
0
votes0
answers57
viewsExecute string code in C#
I’m a C# beginner and I built a code inside a string and I need it to be executed. string MyString = "MyPictureBox.BackColor = Color.Red;"; I have found other similar questions (including apologies…
-
0
votes2
answers38
viewsCompile string as code
I have a string in Vbscript that I need to run as code, as I would do? I read some articles about Eval and Execute Statement but I did not find a clear explanation or did not understand correctly...…
-
0
votes1
answer58
viewsCheck if it is a valid account
I’m making a Mysql query in which one of the columns would be the result of a calculation. However, I need to check in PHP if this account is valid. For example, Pow(-0.2,0.5) would be an impossible…
-
0
votes1
answer75
viewsUse of Eval. Is there any alternative in this case?
I came across the functionalities of eval() and I started using, but I learned about the risk in using eval() next to a input external. I use the eval() to receive from a input-text to string which…
-
0
votes0
answers40
viewsHow to execute a string’s instructions
I have a string: string str="for(int x = 0; x < 10; x++) Console.Write(\"hello\");" How do I execute the instructions for this string? for(int x = 0; x < 10; x++) Console.Write("hello");…