<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.bson.functions.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'de',
  ),
  'this' => 
  array (
    0 => 'function.mongodb.bson-fromphp.php',
    1 => 'MongoDB\\BSON\\fromPHP',
    2 => 'Returns the BSON representation of a PHP value',
  ),
  'up' => 
  array (
    0 => 'ref.bson.functions.php',
    1 => 'Funktionen',
  ),
  'prev' => 
  array (
    0 => 'function.mongodb.bson-fromjson.php',
    1 => 'MongoDB\\BSON\\fromJSON',
  ),
  'next' => 
  array (
    0 => 'function.mongodb.bson-tocanonicalextendedjson.php',
    1 => 'MongoDB\\BSON\\toCanonicalExtendedJSON',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/mongodb/functions/bson/fromphp.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.mongodb.bson-fromphp" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">MongoDB\BSON\fromPHP</h1>
  <p class="verinfo">(mongodb &gt;=1.0.0)</p><p class="refpurpose"><span class="refname">MongoDB\BSON\fromPHP</span> &mdash; <span class="dc-title">Returns the BSON representation of a PHP value</span></p>

 </div>

 <div id="function.mongodb.bson-fromphp-refsynopsisdiv">
  <div class="warning"><strong class="warning">Warnung</strong>
   <p class="simpara">
    This function has been <em>DEPRECATED</em> as of extension
    version 1.20.0 and was removed in 2.0. Applications should use
    <span class="methodname"><a href="mongodb-bson-document.fromphp.php" class="methodname">MongoDB\BSON\Document::fromPHP()</a></span> instead.
   </p>
  </div>
 </div>

 <div class="refsect1 description" id="refsect1-function.mongodb.bson-fromphp-description">
  <h3 class="title">Beschreibung</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>MongoDB\BSON\fromPHP</strong></span>(<span class="methodparam"><span class="type"><span class="type"><a href="language.types.array.php" class="type array">array</a></span>|<span class="type"><a href="language.types.object.php" class="type object">object</a></span></span> <code class="parameter">$value</code></span>): <span class="type"><a href="language.types.string.php" class="type string">string</a></span></div>

  <p class="simpara">
   Serializes a PHP array or object (e.g. document) to its
   <a href="https://www.mongodb.com/docs/manual/reference/bson-types/" class="link external">&raquo;&nbsp;BSON</a> representation. The
   returned binary string will describe a BSON document.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.mongodb.bson-fromphp-parameters">
  <h3 class="title">Parameter-Liste</h3>
  <dl>
   
    <dt><code class="parameter">value</code> (<span class="type"><span class="type"><a href="language.types.array.php" class="type array">array</a></span>|<span class="type"><a href="language.types.object.php" class="type object">object</a></span></span>)</dt>
    <dd>
     <span class="simpara">
      PHP value to be serialized.
     </span>
    </dd>
   
  </dl>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.mongodb.bson-fromphp-returnvalues">
  <h3 class="title">Rückgabewerte</h3>
  <p class="simpara">
   The serialized BSON document as a binary string.
  </p>
 </div>


 <div class="refsect1 errors" id="refsect1-function.mongodb.bson-fromphp-errors">
  <h3 class="title">Fehler/Exceptions</h3>
  <ul class="simplelist">
   <li>
    Throws
    <span class="classname"><a href="class.mongodb-driver-exception-unexpectedvalueexception.php" class="classname">MongoDB\Driver\Exception\UnexpectedValueException</a></span> if
    the PHP value cannot be converted to BSON. Possible reasons include, but are
    not limited to, encountering an unexpected
    <span class="interfacename"><a href="class.mongodb-bson-type.php" class="interfacename">MongoDB\BSON\Type</a></span> instance or
    <span class="function"><a href="mongodb-bson-serializable.bsonserialize.php" class="function">MongoDB\BSON\Serializable::bsonSerialize()</a></span> failing to
    return an <span class="type"><a href="language.types.array.php" class="type array">array</a></span> or <span class="classname"><a href="class.stdclass.php" class="classname">stdClass</a></span>.
   </li>
  </ul>
 </div>


 <div class="refsect1 changelog" id="refsect1-function.mongodb.bson-fromphp-changelog">
  <h3 class="title">Changelog</h3>
  <table class="doctable informaltable">
   
    <thead>
     <tr>
      <th>Version</th>
      <th>Beschreibung</th>
     </tr>

    </thead>

    <tbody class="tbody">
     
       <tr>
        <td>PECL mongodb 2.0.0</td>
        <td>
         Diese Funktion wurde entfernt.
        </td>
       </tr>


    </tbody>
   
  </table>

 </div>


 <div class="refsect1 examples" id="refsect1-function.mongodb.bson-fromphp-examples">
  <h3 class="title">Beispiele</h3>
  <div class="example" id="example-1">
   <p><strong>Beispiel #1 <span class="function"><strong>MongoDB\BSON\fromPHP()</strong></span> example</strong></p>
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /><br />$bson </span><span style="color: #007700">= </span><span style="color: #0000BB">MongoDB\BSON\fromPHP</span><span style="color: #007700">([</span><span style="color: #DD0000">'foo' </span><span style="color: #007700">=&gt; </span><span style="color: #0000BB">1</span><span style="color: #007700">]);<br />echo </span><span style="color: #0000BB">bin2hex</span><span style="color: #007700">(</span><span style="color: #0000BB">$bson</span><span style="color: #007700">), </span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
   </div>

   <div class="example-contents"><p>Das oben gezeigte Beispiel erzeugt folgende Ausgabe:</p></div>
   <div class="example-contents screen">
<div class="examplescode"><pre class="examplescode">0e00000010666f6f000100000000cat</pre>
</div>
   </div>
  </div>
 </div>



 <div class="refsect1 seealso" id="refsect1-function.mongodb.bson-fromphp-seealso">
  <h3 class="title">Siehe auch</h3>
  <ul class="simplelist">
   <li><span class="methodname"><a href="mongodb-bson-document.fromphp.php" class="methodname" rel="rdfs-seeAlso">MongoDB\BSON\Document::fromPHP()</a> - Construct a new document instance from PHP data</span></li>
   <li><span class="function"><a href="function.mongodb.bson-tophp.php" class="function" rel="rdfs-seeAlso">MongoDB\BSON\toPHP()</a> - Returns the PHP representation of a BSON value</span></li>
   <li><a href="https://www.mongodb.com/docs/manual/reference/bson-types/" class="link external">&raquo;&nbsp;MongoDB BSON</a></li>
   <li><a href="mongodb.persistence.php" class="xref">Persisting Data</a></li>
  </ul>
 </div>


</div><?php manual_footer($setup); ?>