Overview

Namespaces

  • cassandra
  • None
  • PHP
  • phpcassa
    • Batch
    • Connection
    • Index
    • Iterator
    • Schema
      • DataType
    • Util
    • UUID

Classes

  • AsciiType
  • BooleanType
  • BytesType
  • CassandraType
  • CompositeType
  • DateType
  • DoubleType
  • FloatType
  • Int32Type
  • IntegerType
  • LexicalUUIDType
  • LongType
  • TimeUUIDType
  • UTF8Type
  • UUIDType

Interfaces

  • Serialized
  • Overview
  • Namespace
  • Class
  • Tree
 1: <?php
 2: namespace phpcassa\Schema\DataType;
 3: 
 4: use phpcassa\Schema\DataType\Serialized;
 5: 
 6: /**
 7:  * Stores data as a 4-byte single-precision float.
 8:  *
 9:  * @package phpcassa\Schema\DataType
10:  */
11: class FloatType extends CassandraType implements Serialized
12: {
13:     public function pack($value, $is_name=true, $slice_end=null, $is_data=false) {
14:         if ($is_name && $is_data)
15:             $value = unserialize($value);
16:         return strrev(pack("f", $value));
17:     }
18: 
19:     public function unpack($data, $handle_serialize=true) {
20:         $value = current(unpack("f", strrev($data)));
21:         if ($handle_serialize) {
22:             return serialize($value);
23:         } else {
24:             return $value;
25:         }
26:     }
27: }
28: 
phpcassa API documentation generated by ApiGen 2.8.0