PHP Portal » PHP Handbuch » MongoCode::__toString

Werbung

MongoCode::__toString


(PECL mongo >= 0.8.3)

MongoCode::__toStringReturns this code as a string

Beschreibung

public string MongoCode::__toString ( void )

Parameter-Liste

Diese Funktion hat keine Parameter.

Rückgabewerte

This code, the scope is not returned.

Beispiele

PHP Code
1
2
3
4
$code = new MongoCode('return x;', array("x"=>"hi")); echo "$code\n"; $code = new MongoCode('function() { for(i=0;i<10;i++) { db.foo.update({x:i}, {x:i+1}); } }'); echo "$code\n";

Das oben gezeigte Beispiel erzeugt eine ähnliche Ausgabe wie:

return x;
function() { for(i=0;i<10;i++) { db.foo.update({x:i}, {x:i+1}); } }