![]() |
![]() |
-Aster- |
![]()
Post
#1
|
Goście ![]() |
Witam wszystkich!
Jak w temacie czy jest jakiś w sposób dzieki któremu będę mógł zapisać wynik działnia funkcji eval zapisać do tablicy, zmiennej czegokolwiek. dla przykładu, jak napiszę
jest ok. ale jak napisze np tak
to otrzymuję zamiast 3 wyników zmiennej tylko jeden z jakiegoś powodu $zmienna jest ignorowana i wykonywane jest tylko eval($cos_do_wynonania); Powyżej to taki głupi przykład ale oddaje to z czym mam problem. Może ktoś będize mi w stanie pomóc. |
|
|
![]() |
![]()
Post
#2
|
|
Grupa: Przyjaciele php.pl Postów: 7 494 Pomógł: 302 Dołączył: 31.03.2004 Ostrzeżenie: (0%) ![]() ![]() |
Cytat eval (php 3, php 4, php 5 ) eval -- Evaluate a string as php code Description mixed eval ( string code_str ) eval() evaluates the string given in code_str as php code. Among other things, this can be useful for storing code in a database text field for later execution. There are some factors to keep in mind when using eval(). Remember that the string passed must be valid php code, including things like terminating statements with a semicolon so the parser doesn't die on the line after the eval(), and properly escaping things in code_str. Also remember that variables given values under eval() will retain these values in the main script afterwards. A return statement will terminate the evaluation of the string immediately. As of php 4, eval() returns NULL unless return is called in the evaluated code, in which case the value passed to return is returned. In case of a parse error in the evaluated code, eval() returns FALSE. In case of a fatal error in the evaluated code, the whole script exits. In php 3, eval() does not return a value. Nie wiem o co Ci chodzi? eval() działa tak jak powinno i zwraca to co powinno. Prawdopodobnie oczekiwałeś że dostaniesz jakąś konkretną wartość, ale żeby ją dostać w kodzie we wnętrzu eval() musisz użyć return lub jakiejś zmiennej d której podstawisz dane a poza eval() je odczytasz. Ale to wszstko jak byk w manualu (IMG:http://forum.php.pl/style_emoticons/default/exclamation.gif) ! |
|
|
![]()
Post
#3
|
|
Grupa: Zarejestrowani Postów: 17 Pomógł: 0 Dołączył: 18.01.2004 Skąd: Ostrów Wlkp. Ostrzeżenie: (0%) ![]() ![]() |
nie wiem czy dobrze rozumiem, ale prawdopodomnie chodzi o to, ze eval od razy to co przerobi wypluwa do przegladarki, zeby zapisac w zmiennej efekt dzialania eval musisz przechwycic to co ona wypluje do bufora, w ten sposob np.:
|
|
|
![]()
Post
#4
|
|
Grupa: Przyjaciele php.pl Postów: 7 494 Pomógł: 302 Dołączył: 31.03.2004 Ostrzeżenie: (0%) ![]() ![]() |
Cytat(Mery @ 2005-08-30 13:18:28) nie wiem czy dobrze rozumiem, ale prawdopodomnie chodzi o to, ze eval od razy to co przerobi wypluwa do przegladarki, NIE.
|
|
|
![]() ![]() |
![]() |
Aktualny czas: 22.08.2025 - 21:59 |