Jump to content

function name must be a string? what function?

Go to solution Solved by Barand,

Recommended Posts

I keep getting the following error:

Fatal error: Function name must be a string in /home/dmyers53/public_html/Projects/Chisese_Zodiac_for_loop.php on line 34

I dont have a function named, where am I going wrong?

<img src="images/rat.jpg"></img><!--test the source. WORKS-->
ini_set('display_errors', 'on');

echo "<p>This line works</p>\n";//yes it does
$zodiacPictures = array(
for ($imgCounter = 0; $imgCounter <= 12; ++$imgCounter){
echo '<img src="' . $zodiacPictures($imgCounter) . '"></img>';// line 34
Link to comment
Share on other sites

  • Solution

This function


You need [..] for array indexes.

(..) is for functions


[edit] Using foreach() would be easier

foreach ($zodiacPictures as $src){
    echo '<img src="' . $src . '" />';

and there are no </img> tags

Edited by Barand
  • Like 1
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

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.