wb_get_address

int wb_get_address (mixed var)

Returns the address (as an integer pointer) of the variable var. var can be a string, integer, boolean, or double. This function is specially suited to use with wb_peek() and wb_poke().

Example

// Change characters in a string

$str = "Test string";
$addr = wb_get_address($str);
echo wb_peek($addr) . "\n";
wb_poke($addr, "Roo");
echo wb_peek($addr) . "\n";
echo "$str\n\n";

// Change the value of an integer

$num = 1234;
$addr = wb_get_address($num);
$array = (unpack("Vnum", wb_peek($addr, 4)));
echo "{$array['num']}\n";
wb_poke($addr, pack("V", 800), 4);
$array = (unpack("Vnum", wb_peek($addr, 4)));
echo "{$array['num']}\n";
echo "$num\n\n";

See also

wb_peek
wb_poke
Low-level functions