Skip to content

Instantly share code, notes, and snippets.

@blockworks
Created July 6, 2011 04:20
Show Gist options
  • Save blockworks/1066557 to your computer and use it in GitHub Desktop.
Save blockworks/1066557 to your computer and use it in GitHub Desktop.
文字列をバイナリにしてファイルに保存する(.act)
<?php
$hex_str = "cc0000333333ffffff0000ff222222cc0000333333ffffff0000ff222222cc0000333333ffffff0000ff222222cc0000333333ffffff0000ff222222cc0000333333ffffff0000ff222222cc0000333333ffffff0000ff222222cc0000333333ffffff0000ff222222cc0000333333ffffff0000ff222222cc0000333333ffffff0000ff222222cc0000333333ffffff0000ff222222cc0000333333ffffff0000ff222222cc0000333333ffffff0000ff222222cc0000333333ffffff0000ff222222cc0000333333ffffff0000ff222222cc0000333333ffffff0000ff222222cc0000333333ffffff0000ff222222cc0000333333ffffff0000ff222222cc0000333333ffffff0000ff222222cc0000333333ffffff0000ff222222cc0000333333ffffff0000ff222222cc0000333333ffffff0000ff222222cc0000333333ffffff0000ff222222cc0000333333ffffff0000ff222222cc0000333333ffffff0000ff222222cc0000333333ffffff0000ff222222cc0000333333ffffff0000ff222222cc0000333333ffffff0000ff222222cc0000333333ffffff0000ff222222cc0000333333ffffff0000ff222222cc0000333333ffffff0000ff222222cc0000333333ffffff0000ff222222cc0000333333ffffff0000ff222222cc0000333333ffffff0000ff222222cc0000333333ffffff0000ff222222cc0000333333ffffff0000ff222222cc0000333333ffffff0000ff222222cc0000333333ffffff0000ff222222cc0000333333ffffff0000ff222222cc0000333333ffffff0000ff222222cc0000333333ffffff0000ff222222cc0000333333ffffff0000ff222222cc0000333333ffffff0000ff222222cc0000333333ffffff0000ff222222cc0000333333ffffff0000ff222222cc0000333333ffffff0000ff222222cc0000333333ffffff0000ff222222cc0000333333ffffff0000ff222222cc0000333333ffffff0000ff222222cc0000333333ffffff0000ff222222cc0000333333ffffff0000ff222222cc0000333333ffffff0000ff222222cc0000";
$bin_str = pack("H*" , $hex_str);
echo $bin_str;
$fp = fopen('test.act', 'w+');
fwrite($fp, $bin_str);
fclose($fp);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment