Results 1 to 3 of 3

Thread: [RESOLVED] it doesn't work in function

Threaded View

  1. #1

    Thread Starter
    Frenzied Member wiz126's Avatar
    Join Date
    Jul 2005
    Location
    Mars,Milky Way... Chit Chat Posts: 5,733
    Posts
    1,080

    Resolved [RESOLVED] it doesn't work in function

    ok My code doesn't work when its in a function, yet it does when its not why is that?

    This Works:
    PHP Code:
    $handle fopen("http://www.runescape.com/lang/en/aff/runescape/serverlist.ws?lores.x=0&plugin=0&order=WPML","r");
    if(
    $handle){
    while (!
    feof($handle)) {
    $contents .= fread($handle,8192);}
    fclose($handle);}

    $world 2;
    $lengthA strpos(stristr($contents'World '.$world), 'FULL');
    $lengthB strpos(stristr($contents'World '.$world), 'Players');

    if (
    $lengthA $lengthB){
            echo 
    'Full';
        }
    else
        {
            echo 
    strpos(stristr($contents'World '.$world), 'Players');
        } 
    And This Doesn't:
    PHP Code:
    $handle fopen("http://www.runescape.com/lang/en/aff/runescape/serverlist.ws?lores.x=0&plugin=0&order=WPML","r");
    if(
    $handle){
    while (!
    feof($handle)) {
    $contents .= fread($handle,8192);}
    fclose($handle);}
       

    function 
    Population($world)  {
        
    $lengthA strpos(stristr($contents'World '.$world), 'FULL');
        
    $lengthB strpos(stristr($contents'World '.$world), 'Players');
        
        if (
    $lengthA $lengthB){
                return 
    "Full";
            }
        else
            {
                return 
    strpos(stristr($contents'World '.$world), 'Players');
            }
    }
    echo 
    Population(2); 
    Why is that?
    Last edited by wiz126; Feb 6th, 2007 at 05:15 PM.
    1) If your post has been adequately answered please click in your post on "Mark Thread Resolved".
    2) If someone has been useful to you please show your respect by rating their posts.
    3) Please use [highlight="VB"] 'your code goes in here [/highlight] tags when posting code.
    4) Before posting your question, make sure you checked this links:
    MICROSOFT MSDN -- VB FORUMS SEARCH

    5)Support Classic VB - A PETITION TO MICROSOFT

    ___________________________________________________________________________________
    THINGS TO KNOW ABOUT VB: || VB Examples/Demos
    What are Classes?
    || -
    Where to place a sub/function?(global) || Webbrowser control

Posting Permissions

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



Click Here to Expand Forum to Full Width