PHP scripts for converting IPs

The next two scripts are used for converting hex ips used by phpbb2 in databases. Ex. hex ip for 192.168.1.1 is C0A80101

#!/bin/php
<?
  printf("%08X\n",ip2long($argv[1]));

hex2ip

#!/bin/php
<?
  echo long2ip(hexdec($argv[1]))."\n";

And these are used for converting IPs to integer and back. Ex. integer ip for 192.168.1.1 is 3232235777

ip2int

#!/bin/php
<?
//some hacks to workaround php signed integers
  echo base_convert(sprintf("%08X",ip2long($argv[1])),16,10)."\n";

ip2int

#!/bin/php
<?
//nothing special - just php function
  echo long2ip("3232235777")."\n";