TypedValue* HHVM_FUNCTION(pack, ActRec* ar) { int num = ar->numArgs(); String format(getArg<KindOfString>(ar,0)); Array extra = Array::Create(); for (int i = 1; i<num; i++) { extra.append(getArgVariant(ar,i)); } Variant result = ZendPack().pack(format, extra); // pack() returns false if there was an error if (!result.isBoolean()) { tvCastToStringInPlace(result.asTypedValue()); } return arReturn(ar, std::move(result)); }
Variant HHVM_FUNCTION(unpack, const String& format, const String& data) { return ZendPack().unpack(format, data); }
Variant HHVM_FUNCTION(pack, const String& format, const Array& argv) { // pack() returns false if there was an error, String otherwise return ZendPack().pack(format, argv); }
Variant f_unpack(const String& format, const String& data) { return ZendPack().unpack(format, data); }
Variant f_pack(int _argc, const String& format, CArrRef _argv /* = null_array */) { return ZendPack().pack(format, _argv); }
Variant f_unpack(CStrRef format, CStrRef data) { return ZendPack().unpack(format, data); }