Edit report at http://bugs.php.net/bug.php?id=15135&edit=1
ID: 15135 Updated by: [email protected] Reported by: tom dot polak at post dot sk Summary: improving eval() with context -Status: Open +Status: Closed Type: Feature/Change Request -Package: Feature/Change Request +Package: *General Issues Operating System: Solaris PHP Version: 4.1.0 -Assigned To: +Assigned To: jani Block user comment: N Private report: N Previous Comments: ------------------------------------------------------------------------ [2002-01-21 03:15:52] 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 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=15135&edit=1
