php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #15135 improving eval() with context
Submitted: 2002-01-21 03:15 UTC Modified: 2010-12-29 17:42 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: tom dot polak at post dot sk Assigned: jani (profile)
Status: Closed Package: *General Issues
PHP Version: 4.1.0 OS: Solaris
Private report: No CVE-ID: None
 [2002-01-21 03:15 UTC] tom dot polak at post dot sk
Hello,
this request is related to #15101.
Sample:

function a($like){
	$id, $name array;
	$val = "select ID, NAME from PEOPLE where NAME like\"{$like}\" into $id, $name";
	$x = getContext();
	sql_fetch_array($val, $x);
	show_result($id, $name);
}

function sql_fetch_array($query, $context){
	...there we separate into part of query, 
	run i.e.mysql_fetch_array into $result,
	for each resulting row we run something 
	like this:
	eval("$id[".$index."] = ".$result[ID], $context);
}

The thing logic is, that we can change variables ouside its regular scope.
In this example we do it by previously saved "context". I propose this type 
of solution, because I have it already in my previous development tool.
Maybe exist any more possibilities, how to do that.
This is useful to write many of general functions for (in my case) high 
quality SQL support.
If any other question about this, write me.
Best regards,
Tomas Polak

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-12-29 17:42 UTC] jani@php.net
-Status: Open +Status: Closed -Package: Feature/Change Request +Package: *General Issues -Assigned To: +Assigned To: jani
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Jun 01 10:01:30 2024 UTC