note 104442 added to function.include

From: Date: Wed, 15 Jun 2011 16:33:06 +0000
Subject: note 104442 added to function.include
Groups: php.notes 
Request: Send a blank email to php-notes+get-180552@lists.php.net to get a copy of this message
@jdrjsbl: I'm new here, too, so this may not be 100% correct... First of all, I don't think you need additional <?php ?> tags around your include, because it's just another built in function (like echo). Secondly, it seems that you can't nest an include inside of an echo. I got your code to work by breaking the string in to two parts and putting the include on its own line, between them: <?php $foo='<html><head><title>some title</title></head><body><table><tr><td>some text '; $bar=' some more text</tr></td></table></body></html>'; echo $foo; include("test.php"); echo $bar; ?> Maybe one of the pros around here can think of a better way to do this, though. Hope that helps! ---- Server IP: 69.147.83.197 Probable Submitter: 76.164.43.198 ---- Manual Page -- http://www.php.net/manual/en/function.include.php Edit -- https://master.php.net/note/edit/104442 Del: integrated -- https://master.php.net/note/delete/104442/integrated Del: useless -- https://master.php.net/note/delete/104442/useless Del: bad code -- https://master.php.net/note/delete/104442/bad+code Del: spam -- https://master.php.net/note/delete/104442/spam Del: non-english -- https://master.php.net/note/delete/104442/non-english Del: in docs -- https://master.php.net/note/delete/104442/in+docs Del: other reasons-- https://master.php.net/note/delete/104442 Reject -- https://master.php.net/note/reject/104442 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#180552) next »