 |
Account Login
|
 |
 |
Latest Articles
|
 |
 |
IRC Channel
|
 |
 |
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: 483
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: 460
Thanks: 49
|
It might be kinda lame but there is always var_dump();.
PHP Code:
$myVar = 'TalkPHP'; var_dump($myVar);
__________________
"Life is a bitch, take that bitch on a ride"
|
|
|
|
The Following User Says Thank You to ReSpawN For This Useful Post:
|
|
03-01-2008, 09:15 PM
|
#4 (permalink)
|
|
La Vida es Sueño
Join Date: Sep 2007
Location: Oldham
Posts: 2,215
Thanks: 90
|
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: 460
Thanks: 49
|
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);
__________________
"Life is a bitch, take that bitch on a ride"
|
|
|
03-01-2008, 10:58 PM
|
#6 (permalink)
|
|
Moderateur
Join Date: Apr 2007
Posts: 1,239
Thanks: 3
|
__________________
salathe@php.net
|
|
|
|
|
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: 460
Thanks: 49
|
Quote:
Originally Posted by Salathe
|
...? I don't get it?
__________________
"Life is a bitch, take that bitch on a ride"
|
|
|
03-02-2008, 07:13 PM
|
#8 (permalink)
|
|
The Contributor
Join Date: Jan 2008
Posts: 87
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: 1,239
Thanks: 3
|
It outputs data without using print/echo. Put it in a .php file and try for yourself.
__________________
salathe@php.net
|
|
|
|
03-03-2008, 12:24 AM
|
#10 (permalink)
|
|
how quixotic are you?
Join Date: Dec 2007
Location: Lapeer, MI
Posts: 445
Thanks: 37
|
|
|
|
|
03-03-2008, 02:39 AM
|
#11 (permalink)
|
|
The Frequenter
Join Date: Dec 2007
Location: In my basement
Posts: 385
Thanks: 47
|
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: 460
Thanks: 49
|
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.
__________________
"Life is a bitch, take that bitch on a ride"
|
|
|
03-12-2008, 05:30 PM
|
#13 (permalink)
|
|
The Prestige
Join Date: Oct 2007
Location: Manchester, UK
Posts: 836
Thanks: 31
|
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?
__________________
mysql> SELECT * FROM `users` WHERE `users`.`clue` > 0;
Empty set (0.00 sec)
|
|
|
|
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 Prestige
Join Date: Dec 2007
Posts: 1,042
Thanks: 193
|
PHP Code:
<?= "Hello World." ?>
__________________
VillageIdiot can have my babbies ;d
|
|
|
|
03-14-2008, 01:41 PM
|
#17 (permalink)
|
|
The Frequenter
Join Date: Nov 2007
Location: Netherlands
Posts: 460
Thanks: 49
|
PHP Code:
<?php exit('TalkPHP'); ?>
__________________
"Life is a bitch, take that bitch on a ride"
|
|
|
03-25-2008, 06:43 PM
|
#18 (permalink)
|
|
The Wanderer
Join Date: Mar 2008
Posts: 18
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);
?>

|
|
|
|
|
The Following User Says Thank You to martins256 For This Useful Post:
|
|
03-26-2008, 01:47 AM
|
#19 (permalink)
|
|
The Prestige
Join Date: Dec 2007
Posts: 1,042
Thanks: 193
|
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, 29, 3, "PHP", $text_color);
imagepng($im);
imagedestroy($im);
?>

|
So simple yet, so good looking xD
__________________
VillageIdiot can have my babbies ;d
|
|
|
|
04-28-2008, 05:27 AM
|
#20 (permalink)
|
|
The Addict
Join Date: Jan 2008
Location: los angeles
Posts: 305
Thanks: 44
|
Quote:
Originally Posted by Orc
So simple yet, so good looking xD
|
wow i didnt know you can do that with php
__________________
no signature set
|
|
|
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|