<?PHP
$signup_errors = array();
$signup_errors['captcha'] = 'test 1';
$signup_errors['something'] = 'test 2';
$signup_errors['another'] = 'test 3';
$signup_errors['getthepoint'] = 'test 4';
//this would work
if (isset($signup_errors) && in_array('test 4', $signup_errors)){
echo 'it works';
}
//However I need something like this to...
At work I've been dealing with some complex forms (publish pages of Symphony) that contain multiple image upload fields. I need a way to quickly merge $_FILES with $_POST, unfortunately you cannot simply merge the two with array_merge because they don't follow the same structure.
Basically if you have $_POST[a][b] it would be $_FILES[a]...
Hi, I have a array that looks like this
Array
(
[provider] => Array
(
[id] => provider1
[distribuitor] => Array
(
[0] => Array
(
[name] => distribuitor1
[machines] => Array
(
...
If I write
int *columns[32];
am I defining an array with 32 pointers to ints?
Or is it a pointer to an array of 32 ints?
How do I differentiate between the two? Is there a difference?
...
Hello
I'm fairly new to vbscript and I'm struggling a little as I'm more familiar with Javascript.
Can someone please give me a hand?
Does vbscript allow the use of named array keys like I have in my example below?
For example I have:
Dim result(3)
result(age) = 60
result(firstname) = "Tony"
result(height) = 187
result(w...
I have a list of names and phone numbers like so:
var phonelist = List<string[]>
{
new string[] {"Bill", "1234", "12345", "12314" },
new string[] {"Bob", "", "12345", "12314" },
new string[] {"Chris", "", "", "12314" },
new string[] {"Dave", "1234", "", "12314" },
new string[] {"Andy", "1234", "12345", "" },
}
...
Ok I know this is simple, in fact damn simple, I did this in the last project about a week ago, but I don't know why it has skipped off my head.
Input:
$word = "stack";
What I want to do is:
$array = array("s", "t", "a", "c", "k");
Any help will be appreciated!
...
I have a small problem here.I need to convert a string read from console into each character of string. For example string: "aabbab" I want to this string into array of string.How would I do that?
...
I need a language lawyer with authoritative sources.
Take a look at the following test program which compiles cleanly under gcc:
#include <stdio.h>
void foo(int *a) {
a[98] = 0xFEADFACE;
}
void bar(int b[]) {
*(b+498) = 0xFEADFACE;
}
int main(int argc, char **argv) {
int a[100], b[500], *a_p;
*(a+99) = 0xDEADBEEF;
*(b+499...
What's the fastest way to populate an array with the numbers 1-100 in PHP? I want to avoid doing something like this:
$numbers = '';
for($var i = 0; i <= 100; $i++) {
$numbers = $i . ',';
}
$numberArray = $numbers.split(',');
It seems long and tedious, is there a faster way?
...
There doesn't seem to be a way to expand a JavaScript Array with another Array, i.e. to emulate Python's extend method.
What I want to achieve is the following:
>>> a = [1, 2]
[1, 2]
>>> b = [3, 4, 5]
[3, 4, 5]
>>> SOMETHING HERE
>>> a
[1, 2, 3, 4, 5]
I know there's a a.concat(b) method, but it creates a new array instead of simply e...
on linux, with 16 GB of ram, why would the following segfault:
#include <stdlib.h>
#define N 44000
int main(void) {
long width = N*2 - 1;
int * c = (int *) calloc(width*N, sizeof(int));
c[N/2] = 1;
return 0;
}
According to gdb the problem is from c[N/2] = 1 , but I do not know the reason
thanks
...
I'm trying to print the values of an int array to a local file. However, I can't seem to find a way to print the integers out in their standard form (1,2,3) instead of a heap address: ([I@1befab0)
My code fragment is below:
PrintWriter pr = new PrintWriter("file");
for (int i=0; i<views.length ; i++){
pr.pr...
I am in a bind, multiple times on a page for different form items, I insert a css div class into a form item ONLY if an error_array key exists, this is how I highlight a form item that has an error in it.
Works, great if I have an error because then my error array is set, problem is before an error is set, it tries to look for an array ...
I can't for the life of me figure out how to do this properly. I have a class that needs to store some constants (text that corresponds to values in an enum type) - I have it declared like this (publicly) in my class:
const static char* enumText[];
And I'm trying to initialize it like this:
const char* MyClass::enumText[] = { "A", "...
I'm working with various XML inputs and outputs and simply want to grab the keys and values like you can with an array.
Is there a simple function that can convert xml to an array or access the keys and values or am I going about this completely the wrong way?
<?php
$xmlstr = "
<key>
<parent1>
<child1>val1</child1>
<child...
I've made a function that processes an array of objects, process(Object[]). It works on any type including integers and floats so long as you box each element first. I'd like the function to take unboxed elements aswell, if only to box it itself before processing. How do I do that?
I could wrap with a few functions like process(int[]) a...
I am writing a Perl script to do some mathematical operations on a hash. This hash contains the values as given in the sample below. I have written the code below. If I execute this code for an array value separately without using a foreach loop, the output is fine. But if I run this using a foreach loop on the array values, the sum for...
What is the most efficient way of converting a single column linq query to a string array?
private string[] WordList()
{
DataContext db = new DataContext();
var list = from x in db.Words
orderby x.Word ascending
select new { x.Word };
// return string array here
}
...
I have a simple JavaScript Array object containing a few numbers.
[267, 306, 108]
Is there a function that would find the largest number in this array?
...