HEX
Server: LiteSpeed
System: Linux d8 4.18.0-553.121.1.lve.el8.x86_64 #1 SMP Thu Apr 30 16:40:41 UTC 2026 x86_64
User: wbwebdes (3015)
PHP: 8.1.31
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: /home/wbwebdes/domains/survey.wb-webdesign.com/public_html/vendor/tiamo/spss/examples/read.php
<?php

require __DIR__ . '/../vendor/autoload.php';

$files = array(
    // __DIR__ . '/test2.sav',
    __DIR__ . '/data.sav',
);

function __header($str, $char = '#')
{
    $line = str_repeat($char, 100);

    $res = '';
    $res .= $line . PHP_EOL;
    $res .= "#\t\t" . $str . PHP_EOL;
    $res .= $line . PHP_EOL;

    return $res;
}

function __title($title, $char = '.')
{
    return PHP_EOL .
        str_repeat($char, 10) . ' ' .
        mb_strtoupper($title) . ' ' .
        str_repeat($char, 70) .
        PHP_EOL;
}

function __content($data)
{
    $data = json_encode($data);
    // $data = json_decode($data, true);

    return print_r($data, true);
}

foreach ($files as $file) {
    $reader = \SPSS\Sav\Reader::fromFile($file)->read();

    echo PHP_EOL;

    echo __header(sprintf('OPEN FILE %s', $file));

    echo __title('Header');
    echo __content($reader->header);

    echo __title('Documents');
    echo __content($reader->documents);

    echo __title('Variables');
    echo __content($reader->variables);

    echo __title('Values-labels');
    echo __content($reader->valueLabels);

    echo __title('Additional-info');
    echo __content($reader->info);

    echo __title('Data');
    echo __content($reader->data);

    echo PHP_EOL;
}