Jump to content

Archived

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

sjade1

create_function

Recommended Posts

I'm trying to create a function to take care of explode

$characterExploder = create_function('$a', 'return list($cName, $cImage, $cDescription) = explode("|",$a);');

$data = "Jack|picture.jpg|about Jack";

$characterExploder($data);
echo"
1: $cName<br>
2: $cImage<br>
3: $cDescription";

Returns:
1:
2:
3:

They're all blank...not sure why..?
Any help would be appreciated, thank you.

Share this post


Link to post
Share on other sites
Variable scope.

Variables created inside a function are local to that function and not available outside it.

[a href=\"http://us3.php.net/manual/en/language.variables.scope.php\" target=\"_blank\"]http://us3.php.net/manual/en/language.variables.scope.php[/a]

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.