This is a "meta" question that I am asking in a effort to better understand some tough nuts I've had to crack lately. Even if you don't get precisely what I'm reaching for here or there is too much text to read through, any practical input is appreciated and probably useful.
Assume you have a website that needs to use data that is store...
Hi guys, I'm having trouble trying to build an array in PHP which will output in the JSON format I am looking for. I will show you what I am trying to achieve and where I have got to so far:
[
{"data":[{"x":3,"y":0},{"x":10,"y":0}]},
{"data":[{"x":11,"y":0},{"x":13,"y":0}]},
{"data":[{"x":12,"y":1},{"x":17,"y":1}]}
]
I am ...
$temp = array();
function show_keys($ar)
{
foreach ($ar as $k => $v )
{
$temp[] = $k;
if (is_array($ar[$k]))
{
show_keys ($ar[$k]);
}
}
return $temp;
}
I tried using that function but it still only returns the first key.
...
Hello!
I'm having problems posting an array using PHP cURL.
I have successfully posted other values to the same page using POST-variables.
But this one is hard to figure out. The only problem is how I should present the data to the server.
I checked the original form using a form analyzer. And the form analyzer shows that the POST vari...
Simply, I seem to be able to write code that either creates a clickable marker for a pop-up infoWindow OR gets the bounds of the returned markers and resets the map extent and zoom levels. I can't seem to combine the two. My example below will nicely set the extent of the map to the results of the query. But I don't quite know how to ...
the subject basically sums it up, but i am working on a calendar in php for a client that should pull events from a table and display them in the appropriate cells.
the calendar table is working no prob, but what i am trying to avoid is making a separate DB call for each day of the month.
i am trying to figure out a way to store the re...
Hi
I need to create 2D jagged array. Think of a matrix. The number of rows is known, the number of columns is not known. For example I need to create array of 10 elements, where type of each element string[]. Why do I need that? The number of columns is not known - this function must simply do the allocation and pass array to some other...
Let's say I would like to manage a multidimensional array like (pseudo-code):
Array $colors
* wine,red
* cheese,yellow
* apple, green
* pear,brown
What code could be used to avoid the following notation, to initialize the array (assuming there will be a hard-coded list of elements=?:
$colors[x][y] = 'something';
...
After creating a multi-dim array like this, how do I sort it?
Assuming 'markers' is already defined:
var location = [];
for (var i = 0; i < markers.length; i++) {
location[i] = {};
location[i]["distance"] = "5";
location[i]["name"] = "foo";
location[i]["detail"] = "something";
}
For the above example, I need to sort it by 'di...
I have this data and i need an output like this type of output.. I basically need to have all the venues and their dates and all the songs associated to them ....if anyone can think of a better structure and how to achieve it I would be very thankful...
{
["Vector Arena - Auckland Central, New Zealand" =>
{
"2010-10-10" => ["...
I have this code here and it works but there has to be a better way.....i need two arrays that look like this
[
{
"Vector Arena - Auckland Central, New Zealand" => {
"2010-10-10" => [
"Enter Sandman",
"Unforgiven",
"And justice for all"
]
}
},
{
"Brisbane Entertainment Centre - Brisbane Qld, Aus...
I'd like to store the following array in a single text field in a mySQL table:
$user_rating[0] = array('percent' => 'XXXXXXXXXXXXXXXXX',
'category' => 'Category 1',
'description' => 'XXXXXXXXXXXXXXXXX',
'link' => 'XXXXXXXXXXXXXXXXX',
'thumbnail' => 'XXXXXX...
hi,
I'd like to
convert this string:
$credit_packages_string = "300,0.25|1000,0.24|3000,0.22|4000,0.20|5000,0.18|6000,0.16|7000,0.14";
into this array:
$credit_packages = array( array( 'credit_amount'=> 300,
'price_per_credit'=>0.25),
array( 'credit_amount'=> 1000,
'price_per_credit'=>0.24),
array( 'credit...
Are there any functions for recursively exploding and imploding multi-dimensional arrays in PHP?
...
I've tried looking but I haven't found anything with a definitive answer. I know my problem can't be that hard. Maybe it's just that I'm tired..
Basically, I want to declare a pointer to a 2 dimensional array. I want to do it this way because eventually I will have to resize the array. I have done the following successfully with a 1D ar...
I get error in compilation with the following definition.
int matrix[ ][ ] = { { 1, 2, 3}, {4,5,6} };
char str[ ][ ] = { "abc", "fgh" };
Why is the compiler complaining missing subscript and too many initializers.
...
Search an array - I found this function below to search an array which is "great" for single strings, it will match an array value and or array value and matching key within an array, BUT what i really want to do is ONLY match an array where ALL the search values are met/returned. the query example could return matches for any records wh...
Ok I have a mult-dimensional array which has the following structure...
0 =>
array (
'membership' =>
array (
'member' =>
array (
'name' => '',
'landline' => '',
'libcard' => '',
'mobile' => '',
'email' => '',
),
'updated_at' => '',
'member_id' => 12345,...
If the following is possible:
MyFunction(int *array, int size)
{
for(int i=0 ; i<size ; i++)
{
printf(ā%dā, array[i]);
}
}
main()
{
int array[6] = {0, 1, 2, 3, 4, 5};
MyFunction(array, 6);
}
Why the following is not?
MyFunction(int **array, int row, int col)
{
for(int i=0 ; i<row ; i++)
{
...
Hey guys, I got this error message when I tried to trigger the function below. Can anybody help me out? Thanks!
>> changeYuv('tilt.yuv',352,288,1:40,40);
??? Index exceeds matrix dimensions.
Error in ==> changeYuv at 32
j=histogram(imgYuv(:,:,1,k+1));
>> [x,y,z,a]=size(imgYuv)
x =
288
y =
352
z =
3
a =
40...