Hi,
I am trying to write an IF statement that may occur under several different scenarios. I tried to write an array in which each IF statement would occur, but I am not having any luck.
Here is the code I have so far: -
arsort ( $array );
-
$low_to_high = array( "1" => "22", "2" => "23", "3" => "24", "4" => "26", "5" => "27", "6" => "47", "7" => "49", "8" => "50", "9" => "51", "10" => "59", "11" => "61", "12" => "40" );
-
if ( $statistic_id = in_array(array_values($low_to_high), $low_to_high))
-
asort ( $array );
-
Essentially, if $statistic_id equals any of the values in my array, then I want the script to perform asort instead of arsort.
Any guidance would be highly appreciated!
Hello,
Sorry for my convoluted question. It appears as though this can be solved easily by doing this: -
arsort ($array);
-
if ($statistic_id == 22 || $statistic_id == 23 || ... || $statistic_id == n)
-
asort ($array);
-
4 1756
Well where do we start. The index is not needed nor are the quotes - $low_to_high = array(22,23,24,26,...40);
I am not sure what this means - if ( $statistic_id = in_array(array_values($low_to_high), $low_to_high))
But in_array() returns true or false so $statistic_id will become a boolean.
You don't need array_values() because in_array() only checks the array values.
So it looks like you are comparing $low_to_high to itself.
Which will always return true so the line following if() will always execute ....I think.
I don't understand what this means
I tried to write an array in which each IF statement would occur
Also
if $statistic_id equals any of the values in my array, then I want the script to perform asort instead of arsort
What is $statistic_id and what is my array?
I suggest a step back and rethink what you are tring to do.
Also study arrays and how the array functions work.
Hello,
Sorry for my convoluted question. It appears as though this can be solved easily by doing this: -
arsort ($array);
-
if ($statistic_id == 22 || $statistic_id == 23 || ... || $statistic_id == n)
-
asort ($array);
-
It makes more sense now, but your array idea is tidier - $low_to_high = array(22,23,24,26,27,47,49,50,51..);
-
if(in_array($statistic_id ,$low_to_high))
-
asort ($array);
hi my friend
your code that you wrote is seem to be correct only in end line you use
in_array(array_values($low_to_high), $low_to_high)
must be
in_array($low_to_high, $low_to_high)
be successful
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Gactimus |
last post by:
I made the program below. It outputs the smallest number in the array. What
I would like to know is how do I output the array location. I am at a loss.
For example, since the smallest number in...
|
by: Alexei A. Frounze |
last post by:
Hi all,
I have a question regarding the gcc behavior (gcc version 3.3.4).
On the following test program it emits a warning:
#include <stdio.h>
int aInt2 = {0,1,2,4,9,16};
int aInt3 =...
|
by: Arthur Mnev |
last post by:
This is probably beaten to death subject...
Does anyone have a good idea of what penalties are for using Fixed
statement in c#. On one side it allows for much greater flexibility
with casts and...
|
by: Frank |
last post by:
C#: cubearray??
int cubeArray = {{{7, 2}, {1, 4}}, {{3, 5}, {4, 4}}};
How do I interpret the above array statement?
regards,
Frank
|
by: Thierry Loiseau |
last post by:
Hello all,
and Happy end year 2005 !
Well, I would like to obtain a list of all JavaScript var statement,
With "for...in" perharps ?
That is bellow my recent test here, but the problem is...
|
by: Leszek |
last post by:
Hi.
Is it possible in javascript to operate on an array without knowing how mamy
elements it has?
What i want to do is sending an array to a script, and this script should
add all values from...
|
by: Charles |
last post by:
Hello Everyone,
I have been gettting great feedback from microsoft.public.vc.language
group but after doing more searching I think my post should be directed
to this group.
I am trying to make...
|
by: heddy |
last post by:
I have an array of objects. When I use Array.Resize<T>(ref Object,int
Newsize); and the newsize is smaller then what the array was
previously, are the resources allocated to the objects that are...
|
by: ruomingxu via AccessMonster.com |
last post by:
I have an Access database that was designed with Office1995 version. It has
a Sub which has array in it and it doesn't seem working with MS Office 2002
XP version. The program is a bit long but...
|
by: Peter Olcott |
last post by:
http://groups.google.com/group/comp.lang.c++/msg/a9092f0f6c9bf13a
I think that the operator() member function does not work correctly, does
anyone else know how to make a template for making two...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| |