-
Notifications
You must be signed in to change notification settings - Fork 33
Expand file tree
/
Copy pathexample.php
More file actions
31 lines (24 loc) · 743 Bytes
/
example.php
File metadata and controls
31 lines (24 loc) · 743 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php
$ffi = FFI::cdef("
int printf(const char *format, ...);
const char * getenv(const char *);
unsigned int time(unsigned int *);
typedef unsigned int time_t;
typedef unsigned int suseconds_t;
struct timeval {
time_t tv_sec;
suseconds_t tv_usec;
};
struct timezone {
int tz_minuteswest;
int tz_dsttime;
};
int gettimeofday(struct timeval *tv, struct timezone *tz);
", "libc.so.6");
var_dump($ffi->printf("Hello World from %s!\n", "PHP"));
var_dump($ffi->getenv("PATH"));
var_dump($ffi->time(null));
$tv = $ffi->new("struct timeval");
$tz = $ffi->new("struct timezone");
var_dump($ffi->gettimeofday(FFI::addr($tv), FFI::addr($tz)));
var_dump($tv, $tz);