Jump to content

format

Members
  • Posts

    23
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

format's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. if(is_numeric($tmp2[0]))// ignore non number $maxLevels[] = $tmp2[0]; // add JLevel to array Thanks requinix. I have it working. I had a typo which.
  2. Thanks for reply, ya Im not in control of the data. Its coming from a live quote system and they replace what should be a numberwith a text message for any companies that dont return a quote. I tired the below but I think the problem here is I just dont understand how it should work.. I can use is_numeric and even concidered strpos but no joy. Im trying to only add to the array numbers. if(is_numeric($tmp[0])) $maxLevels[] = $tmp[0];
  3. Hi All, I am using the below with great success. It finds for me the MIn and max values allong with the company names. The problem that has just presented itself is some of the data returned in the SLevel is text. I need to ignore text and only include numeric values. Is this possible. I have tried to work this out but have hit a brick wall. Many thanks Jon $SLevels = array(); foreach ($xml->Type->Company as $item) { $companyName = (string) $item->Name; // get the company name $tmp = (array) $item->$Level; if($tmp[0] != '-') $SLevels[] = array($tmp[0], $companyName); // add SLevel and company name to array } $minSLevel = min($SLevels); // get minimum value $minSLevel[0] = str_replace(',', '', $minSLevel[0]); $premium = $minSLevel[0]; $company = $minSLevel[1]; $maxSLevel = max($SLevels); // get minimum value $maxSLevel[0] = str_replace(',', '', $maxSLevel[0]); $maxpremium = $maxSLevel[0]; $maxcompany = $maxSLevel[1];
  4. Many thanks to you all for your replies. Lots to take in. cyberRobot, I tried your suggestion and it worked a charm. Barrand, your suggetion also make sperfect sence. Thank you for this. Good help like this is worth its weight in gold, especialy when on the back foot with time. Thanks again. Jon
  5. Hmmm,all I want is to find the Zurich Life entry and its matching quote. Thats it really. Sorry if not using correct terms etc.
  6. Thanks for the quick answer, a few options to read and learn. Would you know which option above would get me going the quickest. I had a quick look at the documentation and could see how to get the value of [0] and matching [1]. I suspect I have some reading ahead of me, just not sure which methos above I should start with. Many thanks Jon
  7. Hi Guys, I got great help here a few years ago and I wonder if I can ask another related question. I am using the floowing to get the smallest quote from the array below: $minSLevel = min($SLevels); // get minimum value $minSLevel[0] = str_replace(',', '', $minSLevel[0]); Array ( [0] => Array ( [0] => 35.18 [1] => Royal London ) [1] => Array ( [0] => 34.18 [1] => Zurich Life ) [2] => Array ( [0] => 32.74 [1] => Friends First ) [3] => Array ( [0] => 39.13 [1] => Aviva ) [4] => Array ( [0] => 40.59 [1] => Irish Life ) [5] => Array ( [0] => 35.26 [1] => New Ireland ) ) Works great. Is it possible to filter the above to find value of [0] where [1] = Zurich Life Many thanks for any help given. Very much appreciated. Jon
  8. Update, I have it working if not perfectly. <?php $value = max($qresults); $key = array_search($value, $qresults); echo $key; ?> The above works great, it will return the first max it finds if two have the same value. If a better option exists I would be interested in knowing. Many thanks
  9. Apologies if un-clear. I used the number three to simplify things. As a visitor to the site answers multiple quetions about their personal characteristics, 20 different Sessions are created. Each one represnts an "Alter Ego". As each question gets answered the sessions get updated to reflect the persons answers. Each seeion starts off with a zero score and goes up each time by 1 or 3 based on the answers. At the end I would like to get the name and value of the Session with the highest number. I am hoping to put these sessions into an array and eirher sort them or find MAX to locate the right one. Is this possible? Thank you for your time.
  10. I have seven tables storing alter ego character traits. These are looked up as a person answers 7 questions one at a time. I used sessions to hold and increase the weight of each character as the questions where answered. I just wanted to know if it was possible to sort through individual seesions. Your answers may be the right way, I dont question this, they just dont help me awnser the first question.
  11. Ok, your not going to answer the origanal question. Thanks.
  12. The information is created in real time as a user ansers questions about their personality. They do not login so seesions are used to tra\ck results. Sessions get updated as each question is answered.
  13. Hi All, is it poossible to loop through separate PHP SESSIONS to find the MAX Value, ending up with the Name of the SSEEION and its Value Example, I have 3 PHP Seesions: 1. Joe has the value 1 2. Bill has the value 2 3.Jane has the value 3 I would like to get the name of the SESSION with the MAX value. In this case its Jane. Many thanks for help Jon
  14. Thank you for your help, I added $minSLevel[0] = str_replace(',', '', $minSLevel[0]); This seems to be working but the above is far neater. I will have a go with it. Thank you very much for your time and help
  15. From the xml doc returned to via a post from a 3rd party Example below DLevel key="2">1,391.52</DLevel> <DConvertible key="2">1,504.23</DConvertible> <JLevel key="2">1,376.31</JLevel> <JConvertible key="2">1,487.68</JConvertible> <JMortgage key="2">856.76</JMortgage>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.