+ Reply to Thread
Results 1 to 9 of 9

Thread: Help with php function

  1. #1
    zyreena is offline x10Hosting Member zyreena is an unknown quantity at this point
    Join Date
    Apr 2008
    Posts
    57

    Help with php function

    $POINTER = “rebelbar”; Function rebelbar($what_bar);

    {
    Echo “not just rebelbar, $what_bar rebelbar.”;
    }

    How can you call the function rebelbar using $POINTER; without directly calling the function rebelbar. anyone?
    Last edited by zyreena; 05-07-2009 at 10:07 PM. Reason: forgot something
    beginner always starts from the scratch
    www.alliancetutorial.x10hosting.com

  2. #2
    misson is offline x10 Spammer misson is a jewel in the rough
    Join Date
    Mar 2008
    Location
    Libertatia
    Posts
    2,506

    Re: Help with php function

    Are you looking for variable functions? Other than that, any function that takes a callback (such as array_map) could be used to indirectly call a function. Is this just a puzzle or do you have a use in mind?

    Did you write your code in MS Word, by any chance? The smart quotes it generates won't work for PHP. The smart caps look weird, but won't cause problems with the sample you posted. Use a text editor or an IDE to code. When you post code, put it in "[code]" or "[php]" tags to separate it from the rest of your post.

    You've also got an errant ";" after your function declaration. Here's what your code looks like after corrections and with indentation to improve readabiliy:
    PHP Code:
    $POINTER 'rebelbar'

    function 
    rebelbar($what_bar) {
        echo 
    "not just rebelbar, $what_bar rebelbar.\n";

    Last edited by misson; 05-07-2009 at 10:24 PM.

  3. #3
    zyreena is offline x10Hosting Member zyreena is an unknown quantity at this point
    Join Date
    Apr 2008
    Posts
    57

    Re: Help with php function

    tnx misson for the reconstruction of my code, this is my first time to look for help using this forum and a beginner with php.

    regarding your question if i do have a use in my mind? yes i do hav. and i need help how to call the function rebelbar using the $POINTER variable. can i do that or im just critically thinking in a wrong way?
    beginner always starts from the scratch
    www.alliancetutorial.x10hosting.com

  4. #4
    gomarc's Avatar
    gomarc is offline x10 Elder gomarc is an unknown quantity at this point
    Join Date
    Oct 2007
    Location
    USA
    Posts
    511

    Re: Help with php function

    Quote Originally Posted by zyreena View Post
    ... i need help how to call the function rebelbar using the $POINTER variable. can i do that or im just critically thinking in a wrong way?
    Maybe you missed misson’s link to variable functions, so just in case, here you go:

    PHP Code:
    <?php

    $what_bar 
    'your bar';
    $POINTER 'rebelbar'

    $POINTER($what_bar);  // This calls function rebelbar()

    function rebelbar($what_bar) {
        echo 
    "not just rebelbar, $what_bar rebelbar.\n";
    }  

    ?>

  5. #5
    zyreena is offline x10Hosting Member zyreena is an unknown quantity at this point
    Join Date
    Apr 2008
    Posts
    57

    Re: Help with php function

    yah. i really did miss missons "variable function"

    tnx misson and gomarc.
    beginner always starts from the scratch
    www.alliancetutorial.x10hosting.com

  6. #6
    OdieusG is offline x10Hosting Member OdieusG is an unknown quantity at this point
    Join Date
    Jan 2009
    Location
    Bangor, Maine
    Posts
    50

    Re: Help with php function

    Quote Originally Posted by zyreena View Post
    yah. i really did miss missons "variable function"

    tnx misson and gomarc.
    Best bet Zyreen, is think about getting a PHP IDE, this will syntax check your code for you. There's BluMentals' Rapid PHP or PHP Designer. They do syntax check and display syntax colors.....they're not extremely expensive and do the job

    Here are the links, if you're interested in these 2 things.....
    Code:
    http://www.mpsoftware.dk/products.php
    http://www.blumentals.net/rapidphp/

  7. #7
    zyreena is offline x10Hosting Member zyreena is an unknown quantity at this point
    Join Date
    Apr 2008
    Posts
    57

    Re: Help with php function

    tnx odieusg
    Edit:
    thanks very much everyone.
    ]
    how do i close this thread? moderators please close.
    Last edited by zyreena; 05-10-2009 at 10:32 AM. Reason: Automerged Doublepost
    beginner always starts from the scratch
    www.alliancetutorial.x10hosting.com

  8. #8
    xav0989's Avatar
    xav0989 is offline Community Public Relation xav0989 is just really nice
    Join Date
    Jul 2008
    Location
    ifk
    Posts
    4,438

    Re: Help with php function

    @zyreena

    We usually don`t close the posts, as somebody migth need to add something, or add precision. We only close them went there is a clear misconduct toward the rules.
    Xavier L | Community Public Relations Manager (Free Hosting Support)
    █ Yes, my position is too cool to even exist!
    How am I helping? Rate this post by clicking the icon below! (this is even better than "liking" a post)
    Terms of Service | Acceptable Use Policy | x10Hosting Wiki

  9. #9
    zyreena is offline x10Hosting Member zyreena is an unknown quantity at this point
    Join Date
    Apr 2008
    Posts
    57

    Re: Help with php function

    ahh. ok tnx. den
    beginner always starts from the scratch
    www.alliancetutorial.x10hosting.com

+ Reply to Thread

Similar Threads

  1. [PHP] Basics of PHP Scripting
    By jeeter in forum Tutorials
    Replies: 21
    Last Post: 02-03-2010, 04:29 PM
  2. [PHP] Variables in PHP
    By Bryon in forum Tutorials
    Replies: 15
    Last Post: 01-29-2009, 09:46 AM
  3. PHP Function Disabled???
    By stsights in forum Free Hosting
    Replies: 3
    Last Post: 09-14-2008, 11:53 AM
  4. PHP mail function
    By tearsfall in forum Free Hosting
    Replies: 2
    Last Post: 05-09-2008, 08:58 AM
  5. Sigo con problemas con phpbb2
    By reciecho in forum Soporte
    Replies: 7
    Last Post: 10-20-2007, 06:28 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers