Variant f_hphp_current_ref(VRefParam array) { if (!array.isArray()) { throw_bad_array_exception(); return false; } return strongBind(array.array_iter_current_ref()); }
bool f_shuffle(VRefParam array) { if (!array.isArray()) { throw_bad_array_exception(); return false; } array = ArrayUtil::Shuffle(array); return true; }
Array Array::intersect(CVarRef array, bool by_key, bool by_value, PFUNC_CMP key_cmp_function /* = NULL */, const void *key_data /* = NULL */, PFUNC_CMP value_cmp_function /* = NULL */, const void *value_data /* = NULL */) const { if (!array.isArray()) { throw_bad_array_exception(); return Array(); } return diffImpl(array.getArrayData(), by_key, by_value, true, key_cmp_function, key_data, value_cmp_function, value_data); }
bool f_array_walk(VRefParam input, CVarRef funcname, CVarRef userdata /* = null_variant */) { if (!input.isArray()) { throw_bad_array_exception(); return false; } CallCtx ctx; CallerFrame cf; vm_decode_function(funcname, cf(), false, ctx); if (ctx.func == NULL) { return false; } ArrayUtil::Walk(input, walk_func, &ctx, false, NULL, userdata); return true; }
Variant f_array_merge(int _argc, CVarRef array1, CArrRef _argv /* = null_array */) { getCheckedArray(array1); Array ret = Array::Create(); php_array_merge(ret, arr_array1); for (ArrayIter iter(_argv); iter; ++iter) { Variant v = iter.second(); if (!v.isArray()) { throw_bad_array_exception(); return uninit_null(); } CArrRef arr_v = v.asCArrRef(); php_array_merge(ret, arr_v); } return ret; }
bool f_array_walk_recursive(VRefParam input, CVarRef funcname, CVarRef userdata /* = null_variant */) { if (!input.isArray()) { throw_bad_array_exception(); return false; } CallCtx ctx; CallerFrame cf; vm_decode_function(funcname, cf(), false, ctx); if (ctx.func == NULL) { return uninit_null(); } PointerSet seen; ArrayUtil::Walk(input, walk_func, &ctx, true, &seen, userdata); return true; }
Variant f_array_merge_recursive(int _argc, CVarRef array1, CArrRef _argv /* = null_array */) { getCheckedArray(array1); Array ret = Array::Create(); PointerSet seen; php_array_merge_recursive(seen, false, ret, arr_array1); assert(seen.empty()); for (ArrayIter iter(_argv); iter; ++iter) { Variant v = iter.second(); if (!v.isArray()) { throw_bad_array_exception(); return uninit_null(); } CArrRef arr_v = v.asCArrRef(); php_array_merge_recursive(seen, false, ret, arr_v); assert(seen.empty()); } return ret; }
Variant f_array_push(int _argc, VRefParam array, CVarRef var, CArrRef _argv /* = null_array */) { auto const array_cell = array.wrapped().asCell(); if (UNLIKELY(array_cell->m_type != KindOfArray)) { throw_bad_array_exception(); return uninit_null(); } /* * Important note: this *must* cast the parr in the inner cell to * the Array&---we can't copy it to the stack or anything because we * might escalate. */ Array& arr_array = *reinterpret_cast<Array*>(&array_cell->m_data.parr); arr_array.append(var); for (ArrayIter iter(_argv); iter; ++iter) { arr_array.append(iter.second()); } return arr_array.size(); }
bool c_Collator::t_sort(VRefParam arr, int64_t sort_flag /* = q_Collator$$SORT_REGULAR */) { if (!arr.isArray()) { throw_bad_array_exception(); return false; } if (!m_ucoll) { raise_warning("sort called on uninitialized Collator object"); return false; } m_errcode.clear(); bool ret = collator_sort(arr, sort_flag, true, m_ucoll, &(m_errcode)); s_intl_error->m_error.clear(); s_intl_error->m_error.code = m_errcode.code; s_intl_error->m_error.custom_error_message = m_errcode.custom_error_message; if (U_FAILURE(m_errcode.code)) { return false; } return ret; }
bool c_Collator::t_asort(VRefParam arr, int64 sort_flag /* = q_Collator___SORT_REGULAR */) { INSTANCE_METHOD_INJECTION_BUILTIN(Collator, Collator::asort); if (!arr.isArray()) { throw_bad_array_exception(); return false; } if (!m_ucoll) { raise_warning("asort called on uninitialized Collator object"); return false; } m_errcode.clear(); bool ret = collator_asort(arr, sort_flag, true, m_ucoll, &m_errcode); s_intl_error->m_error.clear(); s_intl_error->m_error.code = m_errcode.code; s_intl_error->m_error.custom_error_message = m_errcode.custom_error_message; if (U_FAILURE(m_errcode.code)) { return false; } return ret; }
Variant f_array_map(int _argc, CVarRef callback, CVarRef arr1, CArrRef _argv /* = null_array */) { Array inputs; if (!arr1.isArray()) { throw_bad_array_exception(); return uninit_null(); } inputs.append(arr1); if (!_argv.empty()) { inputs = inputs.merge(_argv); } CallCtx ctx; ctx.func = NULL; if (!callback.isNull()) { EagerCallerFrame cf; vm_decode_function(callback, cf(), false, ctx); } if (ctx.func == NULL) { return ArrayUtil::Map(inputs, map_func, NULL); } return ArrayUtil::Map(inputs, map_func, &ctx); }