Edit report at https://bugs.php.net/bug.php?id=60171&edit=1

 ID:                 60171
 Comment by:         artificialmagic at hotmail dot com
 Reported by:        invictible at live dot co dot uk
 Summary:            Suggestion for new function
 Status:             Wont fix
 Type:               Feature/Change Request
 Package:            Unknown/Other Function
 Operating System:   Windows
 PHP Version:        5.3.8
 Block user comment: N
 Private report:     N

 New Comment:

Who would ever think this was useful?


Previous Comments:
------------------------------------------------------------------------
[2011-10-30 03:39:46] invictible at live dot co dot uk

Expressions such as >, >+ aka something like the comparison operators except, 
in function form.

------------------------------------------------------------------------
[2011-10-30 00:52:48] cataphr...@php.net

This is the purpose of eval (though it would probably be better – including 
versatile – to parse the expression yourself), the "security issues" (really, 
input validation) can be handled by analyzing  the tokens in the strings; see 
token_get_all().

Besides, this request is very vague – for instance it doesn't specify which 
subset of the expressions space would be admissible and gives a rationale for 
it.

Won't fix.

------------------------------------------------------------------------
[2011-10-29 21:28:06] invictible at live dot co dot uk

Description:
------------
I've been looking for a solution on PHP as I need some way to evaluate 
expressions within strings.

Since with if:
$str = '5>6';
if($str)
Would evaluate as true regardless of the expression.

A good possible solution for this may be a function for evaluating the 
expressions in the string, eg. evalexp($str); which would return true or false 
based on the expression within the string.

Eval is an alternative however, it can create security issues when used with 
user provided content for obvious reasons.



------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=60171&edit=1

Reply via email to