",$outSender,$base); } [allowsmilie] => 1 [showsignature] => 0 [ipaddress] => [iconid] => 0 [visible] => 1 [attach] => 0 [infraction] => 0 [reportthreadid] => 0 [isusenetpost] => 1 [msgid] => <3ik6muFlk6jgU1@individual.net> [ref] => <3iifmnFli75pU1@individual.net> <1120145252.886535.23820@o13g2000cwo.googlegroups.com> [htmlstate] => on_nl2br [postusername] => roN [ip] => nospam@hotmail. [isdeleted] => 0 [usergroupid] => [membergroupids] => [displaygroupid] => [password] => [passworddate] => [email] => [styleid] => [parentemail] => [homepage] => [icq] => [aim] => [yahoo] => [msn] => [skype] => [showvbcode] => [showbirthday] => [usertitle] => [customtitle] => [joindate] => [daysprune] => [lastvisit] => [lastactivity] => [lastpost] => [lastpostid] => [posts] => [reputation] => [reputationlevelid] => [timezoneoffset] => [pmpopup] => [avatarid] => [avatarrevision] => [profilepicrevision] => [sigpicrevision] => [options] => [akvbghsfs_optionsfield] => [birthday] => [birthday_search] => [maxposts] => [startofweek] => [referrerid] => [languageid] => [emailstamp] => [threadedmode] => [autosubscribe] => [pmtotal] => [pmunread] => [salt] => [ipoints] => [infractions] => [warnings] => [infractiongroupids] => [infractiongroupid] => [adminoptions] => [profilevisits] => [friendcount] => [friendreqcount] => [vmunreadcount] => [vmmoderatedcount] => [socgroupinvitecount] => [socgroupreqcount] => [pcunreadcount] => [pcmoderatedcount] => [gmmoderatedcount] => [assetposthash] => [fbuserid] => [fbjoindate] => [fbname] => [logintype] => [fbaccesstoken] => [newrepcount] => [vbseo_likes_in] => [vbseo_likes_out] => [vbseo_likes_unread] => [temp] => [field1] => [field2] => [field3] => [field4] => [field5] => [subfolders] => [pmfolders] => [buddylist] => [ignorelist] => [signature] => [searchprefs] => [rank] => [icontitle] => [iconpath] => [avatarpath] => [hascustomavatar] => 0 [avatardateline] => [avwidth] => [avheight] => [edit_userid] => [edit_username] => [edit_dateline] => [edit_reason] => [hashistory] => [pagetext_html] => [hasimages] => [signatureparsed] => [sighasimages] => [sigpic] => [sigpicdateline] => [sigpicwidth] => [sigpicheight] => [postcount] => 4 [islastshown] => [isfirstshown] => [attachments] => [allattachments] => ) --> global array? - PHP Development
Professional Web Applications Themes

global array? - PHP Development

Hi, I got an array and want to define it global, now I get the Warning: Warning: array_push(): First argument should be an array in /srv/www/htdocs/web2/html/php/nospam/pop.php on line 53 and I already placed global $Array in my function. So what to do? Thank you!...

  1. #1

    Default global array?

    Hi,

    I got an array and want to define it global, now I get the Warning:
    Warning: array_push(): First argument should be an array in
    /srv/www/htdocs/web2/html/php/nospam/pop.php on line 53
    and I already placed global $Array in my function. So what to do? Thank you!


    roN Guest

  2. #2

    Default Re: global array?

     

    Post full actual code or a minimal executable example that demonstrates
    the problem (but I bet you have mispelt the name of the array).

    ---
    Steve

    Steve Guest

  3. #3

    Default Re: global array?

    roN work wrote: 
    global $array means that you import a global called $array to a local
    function.

    globals are defined outside of any function.

    Regards
    Stefan
    Stefan Guest

  4. #4

    Default Re: global array?

    Steve wrote: 
    >
    > Post full actual code or a minimal executable example that
    > demonstrates the problem (but I bet you have mispelt the name of the
    > array).[/ref]
    Ok: 
    function echoStuff($emailArray, $subjectArray)
    {
    global $spamMail;
    echo "<br>".count($emailArray);
    $base = InitDesign(BASEDESIGN, 0, 0);
    $count=count($emailArray);
    $outSender="";
    for($j=0; $j<$count; $j++ )
    {
    $outSender.="<tr>\n<td bgcolor=\"#FFFF00\">".$j."</td>";// Mailnummer
    $outSender.="<td bgcolor=\"#FF8800\">".$emailArray[$j]."</td>\n";//
    Mailabsender
    $outSender.="<td bgcolor=\"#0088FF\">".$subjectArray[$j]."</td>\n";//
    Mailbetreff
    // [Überprüfen ob mail-adrese bereits auf blacklist ist]
    if (OnBlacklist($emailArray[$j]))
    {
    $outSender.="<td bgcolor=\"#00FF00\"><a
    href=\"".$_SERVER['PHP_SELF']."?remove=".$emailArray[$j]."\">remove from
    blacklist</a></td>\n</tr>\n";
    array_push($spamMail,$j+1); // Nummer des E-Mails welches auf der
    blacklist steht zum 'lösch-Array' hinzufügen
    /*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--That's line 53 and the array $spamMail is
    declared like this at the top: ($spamMail="";
    $spamMail==array(); )
    */
    }
    else
    $outSender.="<td bgcolor=\"#00FF00\"><a
    href=\"".$_SERVER['PHP_SELF']."?spam=".$emailArray[$j]."\">report</a></td>\n
    </tr>\n";
    // [/Überprüfen ob mail-adrese bereits auf blacklist ist]

    }
    echo str_replace("<!--Sender-->",$outSender,$base);
    }


    roN Guest

  5. #5

    Default Re: global array?

    > > > Warning: array_push(): First argument should be an array in
     

    It should be:

    $spamMail = array();

    Your code initialized $spamMail as empty string ($spamMail="";)
    and then compared it to empty array ($spamMail==array();).


    Hilarion
    Hilarion Guest

  6. #6

    Default Re: global array?

    Hilarion wrote: [/ref]

    >
    > It should be:
    >
    > $spamMail = array();
    >
    > Your code initialized $spamMail as empty string ($spamMail="";)
    > and then compared it to empty array ($spamMail==array();).[/ref]

    Oh yes right, I've written down one '=' too much. Thank you! :)


    roN Guest

Similar Threads

  1. php global array help
    By blizbiggy in forum PHP Development
    Replies: 1
    Last Post: June 7th, 04:20 PM
  2. Global Array
    By crisbosch in forum Macromedia Flash Data Integration
    Replies: 0
    Last Post: July 11th, 11:46 PM
  3. Global array usage?
    By RaveRod in forum PHP Development
    Replies: 3
    Last Post: February 3rd, 10:26 AM
  4. PHP5 and Global Array ($_GET)
    By gf in forum PHP Development
    Replies: 5
    Last Post: October 26th, 04:42 PM
  5. how to make a global scope array
    By Comex in forum PHP Development
    Replies: 5
    Last Post: July 26th, 02:42 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139