Welcome to Dream.In.Code
Become a PHP Expert!

Join 149,987 PHP Programmers for FREE! Get instant access to thousands of PHP experts, tutorials, code snippets, and more! There are 1,398 people online right now. Registration is fast and FREE... Join Now!




. Operator and Echoing Arrays

 
Reply to this topicStart new topic

. Operator and Echoing Arrays

max302
27 Nov, 2006 - 04:44 PM
Post #1

Proud supporter of the lulz
Group Icon

Joined: 5 Mar, 2006
Posts: 1,281


Dream Kudos: 200
My Contributions
If have a header function that echos a series of html tags, then at some point an array. I used this to make it print:

CODE


      echo"<div class='banner_logo'> \n
             <img src='".$config['install']."/images/logo.jpg'> \n
            </div> \n";


I remeber seeing this somewhere, in phpbb I think, but on my script, I get a parse error, related to my use of [] to get the array. Is there an alternative method of doing what I want to do without using another echo and therefor another line?
User is offlineProfile CardPM
+Quote Post

snoj
RE: . Operator And Echoing Arrays
27 Nov, 2006 - 04:59 PM
Post #2

Fell off the face of the earth
Group Icon

Joined: 31 Mar, 2003
Posts: 3,325



Thanked: 9 times
Dream Kudos: 750
My Contributions
What's your parse error?
User is offlineProfile CardPM
+Quote Post

Tuzoid
RE: . Operator And Echoing Arrays
28 Nov, 2006 - 12:50 PM
Post #3

D.I.C Head
Group Icon

Joined: 20 Aug, 2006
Posts: 120



Thanked: 2 times
Dream Kudos: 50
My Contributions
you could try:
CODE

<?php
echo "Hi, array : {$config['install']}";
?>


Still provide that parse error though smile.gif
User is offlineProfile CardPM
+Quote Post

max302
RE: . Operator And Echoing Arrays
28 Nov, 2006 - 02:32 PM
Post #4

Proud supporter of the lulz
Group Icon

Joined: 5 Mar, 2006
Posts: 1,281


Dream Kudos: 200
My Contributions

Parse error: parse error, unexpected '[', expecting ',' or ';' in C:\Program Files\xampp\htdocs\pmdbs\includes\header.php on line 49
User is offlineProfile CardPM
+Quote Post

BetaWar
RE: . Operator And Echoing Arrays
28 Nov, 2006 - 03:00 PM
Post #5

#include <soul.h>
Group Icon

Joined: 7 Sep, 2006
Posts: 2,301



Thanked: 101 times
Dream Kudos: 1275
My Contributions
Hm, from the looks of it there is probably a problem with the code above or below that point and it is affected by what is shown there that actually causes the error.
User is online!Profile CardPM
+Quote Post

max302
RE: . Operator And Echoing Arrays
28 Nov, 2006 - 03:04 PM
Post #6

Proud supporter of the lulz
Group Icon

Joined: 5 Mar, 2006
Posts: 1,281


Dream Kudos: 200
My Contributions
But the question remains. What causes?
User is offlineProfile CardPM
+Quote Post

snoj
RE: . Operator And Echoing Arrays
28 Nov, 2006 - 03:09 PM
Post #7

Fell off the face of the earth
Group Icon

Joined: 31 Mar, 2003
Posts: 3,325



Thanked: 9 times
Dream Kudos: 750
My Contributions
Try what tuzoid suggested. Other then that I am stumped.
User is offlineProfile CardPM
+Quote Post

max302
RE: . Operator And Echoing Arrays
28 Nov, 2006 - 04:00 PM
Post #8

Proud supporter of the lulz
Group Icon

Joined: 5 Mar, 2006
Posts: 1,281


Dream Kudos: 200
My Contributions
QUOTE(hotsnoj @ 28 Nov, 2006 - 06:09 PM) *

Try what tuzoid suggested. Other then that I am stumped.

You? Stumped? The PHP meister? Something is terribly wrong here.

EDIT: Tuzoid was right, the php manual confirms.

This post has been edited by max302: 28 Nov, 2006 - 04:50 PM
User is offlineProfile CardPM
+Quote Post

snoj
RE: . Operator And Echoing Arrays
28 Nov, 2006 - 08:12 PM
Post #9

Fell off the face of the earth
Group Icon

Joined: 31 Mar, 2003
Posts: 3,325



Thanked: 9 times
Dream Kudos: 750
My Contributions
What was he right about?

Of course I'm stumpped! That syntax should work just fine, I've even used it! But sometimes (though I myself haven't seen it, but I've heard from others) code for one reason or another just doesn't work.
User is offlineProfile CardPM
+Quote Post

BetaWar
RE: . Operator And Echoing Arrays
28 Nov, 2006 - 09:18 PM
Post #10

#include <soul.h>
Group Icon

Joined: 7 Sep, 2006
Posts: 2,301



Thanked: 101 times
Dream Kudos: 1275
My Contributions
Here is one thing that may help it to work, and I use when the code isn't working and should. Cut the code totally out of the software, save and view the page, then type it back in (not paste), it should work most of the time.

While I cna't say it will work 100% with this it is only because whenever I have had this issue it has been with a mysql query.
User is online!Profile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/8/09 07:36PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live PHP Help!

PHP Tutorials

Reference Sheets

PHP Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month