Skip to content
This repository has been archived by the owner on Jan 20, 2018. It is now read-only.
/ deephp Public archive

php extension that allows the php abstraction of low-level instructions (direct control with memory...)

Notifications You must be signed in to change notification settings

felixcarmona/deephp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

install

phpize it and compile (phpize && ./configure && make) and add "extension=/path/deephp.so" in your php php.ini file

getting the memory address of a variable

$a = 'hello';
$b = array(1, 2, 3, 4);
$c = &$b;

var_dump(get_memory_address($a)); // string(14) "0x7fc7f7559ff8"
var_dump(get_memory_address($b)); // string(14) "0x7fc7f7559ae0"
var_dump(get_memory_address($c)); // string(14) "0x7fc7f7559ae0"

reading the data of a memory address

$a = 'hello';
$b = get_memory_address($a); // $b = "0x7fc7f7559ff8"

var_dump(get_memory_data($b)); // string(5) "hello"

writing data in a memory address

$a = 'hello';
$b = get_memory_address($a); // $b = "0x7fc7f7559ff8"
$c = 'mynewcontent';

set_memory_data($b, $c);
var_dump($a); // string(5) "mynew" -> because the PHP engine remain thinking $a lengths is 5 ('hello') but the real length must be 12 ('mynewcontent')
var_dump(get_memory_data($b)); // string(12) "mynewcontent"

check if two variables are in referencing

$a = 'hello';
$b = array(1, 2, 3, 4);
$c = &$b;

var_dump(are_referenced($a, $b)); // bool(false)
var_dump(are_referenced($c, $b)); // bool(true)

About

php extension that allows the php abstraction of low-level instructions (direct control with memory...)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published