Answer the question
In order to leave comments, you need to log in
Is there a complete analogue of cURL in PHP as a library?
Is there a cURL library in PHP with exactly the same interface as the original one to run scripts that require cURL without editing?
Do not offer extensions, I do not have the ability to install them.
Answer the question
In order to leave comments, you need to log in
No.
And buy yourself a VDS already and don't torture us with your "don't offer extensions". And what is the library in your question?
If you want your bike instead of using Array.every (thanks @k12th ), then something like this:
var num = 5,
all = true,
arr = [1, 5, 7, 9];
for(var i = 0; i < a.length && all; i++) {
if( all )
all = arr[i] == num;
}
for(var i = 0; i < a.length && (all = arr[i] == num); i++);
arr.every(function (elem) { return elem === num })
Array.every
It is probably more reasonable, simpler and more productive to go from the opposite.
var num = 5,
all = true,
arr = [1, 5, 7, 9];
for(var i = 0; i < a.length; i++) {
if(arr[i] != num) {
all = false;
break;
}
}
var num = 5,
arr = [1, 5, 7, 9],
all = arr.length?true:false;
for(var i = 0; i < arr.length; i++)
if(arr[i] != num) {
all = false;
break;
}
var num = 5,
arr = [1, 5, 7, 9];
all=arr.filter(function(item){ return item !=num; }).length?false:true;
there is a useful method for js arrays - every(), the function of checking each value of the array is passed to it and returns true if all elements passed the test
var array = [1, 5, 7, 9],
num = 5, all;
all = array.every(function(val){ return val == num });
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question