Jump to content

Archived

This topic is now archived and is closed to further replies.

keithschm

how to see what is in an array(ALL FIXED THANKS ALL)

Recommended Posts

I have an array and I am not sure what is in it or how deep it is or what the seperater is.  is there any way to just dump an array?

if you echo the array it displays ARRAY
if I use explode  I get nothing as I m not sure what the seperater is


Thanks

Share this post


Link to post
Share on other sites
You can use var_export as well. It will output it as the way you would define it in PHP.

That could be useful for editing configuration files consisting of an array.

Share this post


Link to post
Share on other sites
If you want the output from any of those functions to be readable in the browser window, surround them with [nobbc]<pre></pre>[/nobbc] tags. For example:
[code]<?php
echo '<pre>' . print_r($somearray,true) . '</pre>';
?>[/code]

Ken

Share this post


Link to post
Share on other sites
WOW

thank you all so much for your help.

now this array seems very comlicated to me as it looks like arrays inside arrays

[code]

Array
(
    [0] => Array
        (
            [1DA] => 27.84
        )

    [1] => Array
        (
            [1DP] => 24.23
        )

    [2] => Array
        (
            [2DA] => 14.33
        )

    [3] => Array
        (
            [3DS] => 10.60
        )

    [4] => Array
        (
            [GND] => 6.65
        )

)

[/code]

it is the return values for ups quotes.  I need to alter it.  the text is the shipping type and the numbers is the cost.  I need to subtract the value associted with the GND  from all the other vales in the array

I tried "for each" but I am lost

any sugestion

thanks

Share this post


Link to post
Share on other sites
[quote author=HuggieBear link=topic=110697.msg448063#msg448063 date=1160149859]
How are you propogating the array?

Regards
Huggie
[/quote]

what do you mean?

Share this post


Link to post
Share on other sites

×

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.