SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Dec 2006
    Posts
    49
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Function outputs

    Is it possible to get a string variable back from a function?

    I have a string that I run through a whole bunch of regular expressions in a function (to save me cut and pasting the same thing over and over) but I need it back still as a string variable.

    I'm sure this is an easy problem, but for some reason I've not be able to turn up an answer anywhere.

    Help is appreaciated, thanks.

    function formatFieldText($text){
    changes to $text here

    need to get back the variable of $text

    }
    $bodyText = $_POST['bodyText'];
    formatFieldText($bodyText);

  2. #2
    SitePoint Enthusiast
    Join Date
    Dec 2006
    Posts
    49
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    actually nevermind I'm an idiot.

    it'd use a return and the way to call it would be $bodyText = formatFieldText($_POST['bodyText'];

    ignore me

  3. #3
    Theoretical Physics Student bronze trophy Jake Arkinstall's Avatar
    Join Date
    May 2006
    Location
    Lancaster University, UK
    Posts
    7,062
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Lol.

    The power of sitepoint forums. You don't even need answers to get the solution
    Jake Arkinstall
    "Sometimes you don't need to reinvent the wheel;
    Sometimes its enough to make that wheel more rounded"-Molona


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
  •