 |
Account Login
|
 |
 |
Latest Articles
|
 |
 |
Advertisement
|
 |
 |
Associates
|
 |
 |
Associates
|
 |
|
 |
|
 |
|
 |
03-01-2008, 05:39 PM
|
#1 (permalink)
|
|
The Addict
Join Date: Nov 2007
Posts: 265
Thanks: 2
|
Outputting data without echo/print
Well I'd like to see how inventive you all are in outputting data to the screen without using echo or print or C hooks (Alan)
Here goes my try
PHP Code:
function newecho($text)
{
$path = $_SERVER['DOCUMENT_ROOT'] . '/file.html';
file_put_contents($path,$text);
include_once($path);
}
|
|
|
|
03-01-2008, 07:13 PM
|
#2 (permalink)
|
|
The Frequenter
Join Date: Apr 2005
Location: South UK
Posts: 482
Thanks: 51
|
Can't beat good ol' streams
PHP Code:
function newecho($text)
{
$output = fopen('php://output', 'w');
fputs($output, $text);
}
Alan
|
|
|
03-01-2008, 09:05 PM
|
#3 (permalink)
|
|
The Frequenter
Join Date: Nov 2007
Location: Netherlands
Posts: 393
Thanks: 46
|
It might be kinda lame but there is always var_dump();.
PHP Code:
$myVar = 'TalkPHP'; var_dump($myVar);
__________________
The Addict :: Addicted to (talk)PHP!
|
|
|
|
The Following User Says Thank You to ReSpawN For This Useful Post:
|
|
03-01-2008, 09:15 PM
|
#4 (permalink)
|
|
TalkPHP Loves You
Join Date: Sep 2007
Location: Nottingham
Posts: 1,419
Thanks: 68
|
If we're going to be lame then there's printf, too!
Long live the geniuses.
__________________
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.
|
|
|
03-01-2008, 09:17 PM
|
#5 (permalink)
|
|
The Frequenter
Join Date: Nov 2007
Location: Netherlands
Posts: 393
Thanks: 46
|
Quote:
Originally Posted by Wildhoney
If we're going to be lame then there's printf, too!
Long live the geniuses.
|
Damn it, you beat me to it.
PHP Code:
$name = 'TalkPHP'; $threads = 1365; $posts = 10486; $members = 1892;
$myString = "%1\$s current stats: Threads: %2\$s, Posts: %3\$s, Members: %4\$s";
printf($myString, $name, $threads, $posts, $members);
__________________
The Addict :: Addicted to (talk)PHP!
|
|
|
03-01-2008, 10:58 PM
|
#6 (permalink)
|
|
Moderateur
Join Date: Apr 2007
Posts: 613
Thanks: 2
|
__________________
|
|
|
|
|
The Following 2 Users Say Thank You to Salathe For This Useful Post:
|
|
03-02-2008, 06:46 PM
|
#7 (permalink)
|
|
The Frequenter
Join Date: Nov 2007
Location: Netherlands
Posts: 393
Thanks: 46
|
Quote:
Originally Posted by Salathe
|
...? I don't get it?
__________________
The Addict :: Addicted to (talk)PHP!
|
|
|
03-02-2008, 07:13 PM
|
#8 (permalink)
|
|
The Contributor
Join Date: Jan 2008
Posts: 78
Thanks: 49
|
Quote:
Originally Posted by ReSpawN
...? I don't get it?
|
He didn't say using only PHP. I guess that what Salathe was getting at.
|
|
|
|
03-02-2008, 10:18 PM
|
#9 (permalink)
|
|
Moderateur
Join Date: Apr 2007
Posts: 613
Thanks: 2
|
It outputs data without using print/echo. Put it in a .php file and try for yourself.
__________________
|
|
|
|
03-03-2008, 12:24 AM
|
#10 (permalink)
|
|
The Acquainted
Join Date: Dec 2007
Location: Lapeer, MI
Posts: 108
Thanks: 14
|
__________________
There is no place like 127.0.0.1
|
|
|
|
03-03-2008, 02:39 AM
|
#11 (permalink)
|
|
The Addict
Join Date: Dec 2007
Location: In my basement
Posts: 313
Thanks: 43
|
ummm
PHP Code:
#include <iostream.h> using namespace std; int main() { cout << "Hello World"; return 0; }
|
|
|
03-03-2008, 05:22 AM
|
#12 (permalink)
|
|
The Frequenter
Join Date: Nov 2007
Location: Netherlands
Posts: 393
Thanks: 46
|
Quote:
Originally Posted by StevenF
He didn't say using only PHP. I guess that what Salathe was getting at.
|
Scroll three posts up dude.
__________________
The Addict :: Addicted to (talk)PHP!
|
|
|
03-12-2008, 05:30 PM
|
#13 (permalink)
|
|
The Addict
Join Date: Oct 2007
Location: Manchester, UK
Posts: 339
Thanks: 19
|
Quote:
Originally Posted by Aaron
ummm
PHP Code:
#include <iostream.h> using namespace std;
int main() { cout << "Hello World"; return 0; }
|
i lol'd. good ol' std::cout eh?
__________________
There's nothing an agnostic can't do if he doesn't know whether he believes in anything or not
|
|
|
|
03-13-2008, 01:36 PM
|
#14 (permalink)
|
|
The Addict
Join Date: Nov 2007
Posts: 282
Thanks: 61
|
Quote:
Originally Posted by Salathe
|
;) thats funny
__________________
PHP/XHTML Freelancer:
Cleanscript.com v3 - Programming starting at just $5 act now!
|
|
|
|
03-13-2008, 10:33 PM
|
#15 (permalink)
|
|
The Visitor
Join Date: Dec 2007
Posts: 1
Thanks: 0
|
There is always this:
PHP Code:
<?php
die("Hello World!");
?>
It would cause problems if you wanted to execute code after that though...
|
|
|
|
03-13-2008, 11:09 PM
|
#16 (permalink)
|
|
The Gregarious
Join Date: Dec 2007
Location: On your Hard Drive, hiding like a Virus
Posts: 734
Thanks: 153
|
PHP Code:
<?= "Hello World." ?>
__________________
Wax on, Wax off
|
|
|
|
03-14-2008, 01:41 PM
|
#17 (permalink)
|
|
The Frequenter
Join Date: Nov 2007
Location: Netherlands
Posts: 393
Thanks: 46
|
PHP Code:
<?php exit('TalkPHP'); ?>
__________________
The Addict :: Addicted to (talk)PHP!
|
|
|
03-25-2008, 06:43 PM
|
#18 (permalink)
|
|
The Wanderer
Join Date: Mar 2008
Posts: 6
Thanks: 0
|
PHP Code:
<?php
header ("Content-type: image/png");
$im = @imagecreatetruecolor(51, 20)
or die("Cannot Initialize new GD image stream");
$text_color = imagecolorallocate($im, 255, 255, 255);
imagestring($im, 2, 5, 3, "Talk", $text_color);
$text_color = imagecolorallocate($im, 246, 122, 48);
imagestring($im, 2, 29, 3, "PHP", $text_color);
imagepng($im);
imagedestroy($im);
?>

|
|
|
|
03-26-2008, 01:47 AM
|
#19 (permalink)
|
|
The Gregarious
Join Date: Dec 2007
Location: On your Hard Drive, hiding like a Virus
Posts: 734
Thanks: 153
|
Quote:
Originally Posted by martins256
PHP Code:
<?php
header ("Content-type: image/png");
$im = @imagecreatetruecolor(51, 20)
or die("Cannot Initialize new GD image stream");
$text_color = imagecolorallocate($im, 255, 255, 255);
imagestring($im, 2, 5, 3, "Talk", $text_color);
$text_color = imagecolorallocate($im, 246, 122, 48);
imagestring($im, 2, | | |