MongoDB\BSON\Javascript::__construct

(mongodb >=1.0.0)

MongoDB\BSON\Javascript::__constructConstruct a new Javascript

설명

final public MongoDB\BSON\Javascript::__construct ( string $code [, array|object $scope ] )

인수

code (string)

Javascript code.

scope (array|object)

Javascript scope.

오류/예외

예제

Example #1 MongoDB\BSON\Javascript::__construct() example

<?php

$code 
= new MongoDB\BSON\Javascript('function() { return 1; }');
var_dump($code);

$codews = new MongoDB\BSON\Javascript('function() { return foo; }', ['foo' => 'bar']);
var_dump($codews);

?>

위 예제의 출력:

object(MongoDB\BSON\Javascript)#1 (2) {
  ["javascript"]=>
  string(24) "function() { return 1; }"
  ["scope"]=>
  object(stdClass)#2 (0) {
  }
}
object(MongoDB\BSON\Javascript)#2 (2) {
  ["javascript"]=>
  string(26) "function() { return foo; }"
  ["scope"]=>
  object(stdClass)#1 (1) {
    ["foo"]=>
    string(3) "bar"
  }
}
add a note add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top