PHP 序列化/反序列化的 qbasic 版本
我在任何地方都找不到这个。我正在开发一些旧的基本程序(感谢 qb64 的出现,现在它们可以在 winxp - win7 上运行) 为了序列化(如 php),我需要知道这个过程是如何工作的,以便我可以转换 BASIC 来执行它。它不一定很花哨,但我想了解它是如何工作的。
我喜欢 php 的方式,虽然由于 BASIC 不能做“关联”数组,但我认为它更容易。
所以简单来说,是否有序列化/反序列化的来源?
I can't find this anywhere. I have some old basic programs I am working on (thanks to qb64 that came out, now they work on winxp - win7)
in order to serialize (like php) I need to know how this process works so that i can convert BASIC do it. it does not have to be fancy, but I would like to get an understanding how it works.
I like the way php does it, although since BASIC can not do 'associative" arrays, i would think it is much easier.
so in simple terms, is there a source for serialize/unserialize ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看起来你会用简单的字符串连接来序列化它。使用类似“||”的内容作为你的分隔符。由于没有关联数组,因此您不必担心名称,只需担心值。
然后你可以使用 instr() 和 left$() 或 mid$() 将它们分开。
对于多维数组,它会更加复杂,我还没有给它时间来弄清楚我该怎么做,但我考虑过使用像 ||0|0|| 这样的分隔符对于数组(0,0) 和 ||0|1||对于数组(0,1) 或什至 ||0|1|1||对于数组 (0,1,1)
looks like you'd serialize it with simple string concatenation. Use something like "||" as your seperator. Since there are no associative arrays, you don't have to worry about names, just value.
Then you'd use instr() and left$() or mid$() to split them back out.
For multidimensional arrays, it would be considerably more complex and I haven't given it the time to figure out exactly how I'd do it, but I thought about using seperatators like ||0|0|| for array(0,0) and ||0|1|| for array(0,1) or even ||0|1|1|| for array (0,1,1)