<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/class.mongodb-bson-binary.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'en',
  ),
  'this' => 
  array (
    0 => 'mongodb-bson-binary.fromvector.php',
    1 => 'MongoDB\\BSON\\Binary::fromVector',
    2 => 'Creates a new binary with subtype MongoDB\\BSON\\Binary::SUBTYPE_VECTOR from the given array and vector type',
  ),
  'up' => 
  array (
    0 => 'class.mongodb-bson-binary.php',
    1 => 'MongoDB\\BSON\\Binary',
  ),
  'prev' => 
  array (
    0 => 'mongodb-bson-binary.construct.php',
    1 => 'MongoDB\\BSON\\Binary::__construct',
  ),
  'next' => 
  array (
    0 => 'mongodb-bson-binary.getdata.php',
    1 => 'MongoDB\\BSON\\Binary::getData',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/mongodb/bson/binary/fromvector.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="mongodb-bson-binary.fromvector" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">MongoDB\BSON\Binary::fromVector</h1>
  <p class="verinfo">(mongodb &gt;=2.2.0)</p><p class="refpurpose"><span class="refname">MongoDB\BSON\Binary::fromVector</span> &mdash; <span class="dc-title">Creates a new binary with subtype <strong><code>MongoDB\BSON\Binary::SUBTYPE_VECTOR</code></strong> from the given array and vector type</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-mongodb-bson-binary.fromvector-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">final</span> <span class="modifier">public</span> <span class="modifier">static</span> <span class="methodname"><strong>MongoDB\BSON\Binary::fromVector</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.array.php" class="type array">array</a></span> <code class="parameter">$vector</code></span>, <span class="methodparam"><span class="type"><a href="enum.mongodb-bson-vectortype.php" class="type MongoDB\BSON\VectorType">MongoDB\BSON\VectorType</a></span> <code class="parameter">$vectorType</code></span>): <span class="type"><a href="class.mongodb-bson-binary.php" class="type MongoDB\BSON\Binary">MongoDB\BSON\Binary</a></span></div>

 </div>


 <div class="refsect1 parameters" id="refsect1-mongodb-bson-binary.fromvector-parameters">
  <h3 class="title">Parameters</h3>
  <dl>
   
    <dt><code class="parameter">vector</code> (<span class="type"><a href="language.types.array.php" class="type array">array</a></span>)</dt>
    <dd>
     <p class="para">
      An array of values representing the vector data. The type of each value must match the type indicated by the <code class="parameter">vectorType</code> parameter:
      <ul class="itemizedlist">
       <li class="listitem"><span class="simpara">for <strong><code>MongoDB\BSON\VectorType::Float32</code></strong>, each value must be a <span class="type"><a href="language.types.float.php" class="type float">float</a></span></span></li>
       <li class="listitem"><span class="simpara">for <strong><code>MongoDB\BSON\VectorType::Int8</code></strong>, each value must be an 8-bit <span class="type"><a href="language.types.integer.php" class="type int">int</a></span>, i.e. from <code class="literal">-127</code> to <code class="literal">128</code></span></li>
       <li class="listitem"><span class="simpara">for <strong><code>MongoDB\BSON\VectorType::PackedBit</code></strong>, each value must be a <span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span> or 1-bit <span class="type"><a href="language.types.integer.php" class="type int">int</a></span>, i.e. <code class="literal">0</code> or <code class="literal">1</code></span></li>
      </ul>
     </p>
    </dd>
   
   
    <dt><code class="parameter">vectorType</code> (<span class="type"><a href="enum.mongodb-bson-vectortype.php" class="type MongoDB\BSON\VectorType">MongoDB\BSON\VectorType</a></span>)</dt>
    <dd>
     <p class="para">
      The vector data type.
     </p>
    </dd>
   
  </dl>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-mongodb-bson-binary.fromvector-returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
   Returns a new Binary with subtype <strong><code>MongoDB\BSON\Binary::SUBTYPE_VECTOR</code></strong>.
  </p>
 </div>


 <div class="refsect1 errors" id="refsect1-mongodb-bson-binary.fromvector-errors">
  <h3 class="title">Errors/Exceptions</h3>
  <ul class="simplelist">
   <li>Throws <span class="classname"><a href="class.mongodb-driver-exception-invalidargumentexception.php" class="classname">MongoDB\Driver\Exception\InvalidArgumentException</a></span> on argument parsing errors.</li>
  </ul>
 </div>


 <div class="refsect1 seealso" id="refsect1-mongodb-bson-binary.fromvector-seealso">
  <h3 class="title">See Also</h3>
  <ul class="simplelist">
   <li><span class="methodname"><a href="mongodb-bson-binary.toarray.php" class="methodname" rel="rdfs-seeAlso">MongoDB\BSON\Binary::toArray()</a> - Returns the vector as an array for a Binary with subtype MongoDB\BSON\Binary::SUBTYPE_VECTOR</span></li>
   <li><span class="methodname"><a href="mongodb-bson-binary.getvectortype.php" class="methodname" rel="rdfs-seeAlso">MongoDB\BSON\Binary::getVectorType()</a> - Returns the data type for a Binary with the vector subtype</span></li>
   <li><span class="enumname"><a href="enum.mongodb-bson-vectortype.php" class="enumname">MongoDB\BSON\VectorType</a></span></li>
   <li><a href="https://www.mongodb.com/docs/manual/reference/bson-types/" class="link external">&raquo;&nbsp;BSON Types</a></li>
  </ul>
 </div>


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