<?php
$conn = new PDO('sqlite::memory:');
$conn->exec('CREATE TABLE php81_test (test_int INTEGER NOT NULL, test_decimal NUMERIC(10, 2) DEFAULT NULL, PRIMARY KEY(test_int))');
$conn->exec('INSERT INTO php81_test (test_int, test_decimal) VALUES (1, 1.55)');
$stmt = $conn->query('SELECT * FROM php81_test');
var_dump($stmt->fetch(PDO::FETCH_ASSOC));
$stmt = $conn->query('PRAGMA table_info(php81_test)');
var_dump($stmt->fetch(PDO::FETCH_ASSOC));
- Output for 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.4, 8.3.6
- array(2) {
["test_int"]=>
int(1)
["test_decimal"]=>
float(1.55)
}
array(6) {
["cid"]=>
int(0)
["name"]=>
string(8) "test_int"
["type"]=>
string(7) "INTEGER"
["notnull"]=>
int(1)
["dflt_value"]=>
NULL
["pk"]=>
int(1)
}
- Output for 8.3.5
- Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
array(2) {
["test_int"]=>
int(1)
["test_decimal"]=>
float(1.55)
}
array(6) {
["cid"]=>
int(0)
["name"]=>
string(8) "test_int"
["type"]=>
string(7) "INTEGER"
["notnull"]=>
int(1)
["dflt_value"]=>
NULL
["pk"]=>
int(1)
}
- Output for 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30
- array(2) {
["test_int"]=>
string(1) "1"
["test_decimal"]=>
string(4) "1.55"
}
array(6) {
["cid"]=>
string(1) "0"
["name"]=>
string(8) "test_int"
["type"]=>
string(7) "INTEGER"
["notnull"]=>
string(1) "1"
["dflt_value"]=>
NULL
["pk"]=>
string(1) "1"
}
preferences:
151.71 ms | 402 KiB | 156 Q