O'Reilly logo

haXe 2 by Benjamin Dasnois

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action—Saving the list

In order to save the list, we will serialize it and save the result in a file. This indeed is certainly not the best way to do things but in our case, it will be enough.

public static function save()
{
php.io.File.putContent("zookeeper.data", haxe.Serializer.run(animals));
}

Very simple, isn't it? We are simply serializing the animals list and dumping the result directly in the zookeeper.data file.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required