TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 03-01-2008, 06:39 PM   #1 (permalink)
The Addict
 
Join Date: Nov 2007
Posts: 264
Thanks: 2
TlcAndres is on a distinguished road
Default 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);

TlcAndres is offline  
Reply With Quote
Old 03-01-2008, 08:13 PM   #2 (permalink)
Alan @ CIT
Member of the Month
The Frequenter
Member of the Month Top Contributor 
 
Alan @ CIT's Avatar
 
Join Date: Apr 2005
Location: South UK
Posts: 483
Thanks: 51
Alan @ CIT is on a distinguished road
Default

Can't beat good ol' streams

PHP Code:
function newecho($text)
{
    
$output fopen('php://output''w');
    
fputs($output$text);

Alan
Send a message via MSN to Alan @ CIT
Alan @ CIT is offline  
Reply With Quote
Old 03-01-2008, 10:05 PM   #3 (permalink)
The Frequenter
 
ReSpawN's Avatar
 
Join Date: Nov 2007
Location: Netherlands
Posts: 460
Thanks: 49
ReSpawN is on a distinguished road
Default

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"
Send a message via MSN to ReSpawN
ReSpawN is offline  
Reply With Quote
The Following User Says Thank You to ReSpawN For This Useful Post:
Yoosha (06-04-2008)
Old 03-01-2008, 10:15 PM   #4 (permalink)
La Vida es Sueño
Advanced Programmer Top Contributor 
 
Wildhoney's Avatar
 
Join Date: Sep 2007
Location: Oldham
Posts: 2,280
Thanks: 90
Wildhoney is on a distinguished road
Default

If we're going to be lame then there's printf, too!

php Code:
printf('%s', 'TalkPHP');

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.
Send a message via AIM to Wildhoney Send a message via MSN to Wildhoney Send a message via Yahoo to Wildhoney
Wildhoney is offline  
Reply With Quote
Old 03-01-2008, 10:17 PM   #5 (permalink)
The Frequenter
 
ReSpawN's Avatar
 
Join Date: Nov 2007
Location: Netherlands
Posts: 460
Thanks: 49
ReSpawN is on a distinguished road
Default

Quote:
Originally Posted by Wildhoney View Post
If we're going to be lame then there's printf, too!

php Code:
printf('%s', 'TalkPHP');

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"
Send a message via MSN to ReSpawN
ReSpawN is offline  
Reply With Quote
Old 03-01-2008, 11:58 PM   #6 (permalink)
Moderateur
RegEx Guru PHP Guru Top Contributor Advanced Programmer 
 
Salathe's Avatar
 
Join Date: Apr 2007
Posts: 1,393
Thanks: 5
Salathe is on a distinguished road
Default

PHP Code:
Hello World
Salathe is offline  
Reply With Quote
The Following 2 Users Say Thank You to Salathe For This Useful Post:
Nor (03-13-2008), Yoosha (06-04-2008)
Old 03-02-2008, 07:46 PM   #7 (permalink)
The Frequenter
 
ReSpawN's Avatar
 
Join Date: Nov 2007
Location: Netherlands
Posts: 460
Thanks: 49
ReSpawN is on a distinguished road
Default

Quote:
Originally Posted by Salathe View Post
PHP Code:
Hello World
...? I don't get it?
__________________
"Life is a bitch, take that bitch on a ride"
Send a message via MSN to ReSpawN
ReSpawN is offline  
Reply With Quote
Old 03-02-2008, 08:13 PM   #8 (permalink)
The Contributor
 
Join Date: Jan 2008
Posts: 87
Thanks: 49
StevenF is on a distinguished road
Default

Quote:
Originally Posted by ReSpawN View Post
...? I don't get it?
He didn't say using only PHP. I guess that what Salathe was getting at.
__________________
My Personal and Photo Blog
StevenF is offline  
Reply With Quote
Old 03-02-2008, 11:18 PM   #9 (permalink)
Moderateur
RegEx Guru PHP Guru Top Contributor Advanced Programmer 
 
Salathe's Avatar
 
Join Date: Apr 2007
Posts: 1,393
Thanks: 5
Salathe is on a distinguished road
Default

It outputs data without using print/echo. Put it in a .php file and try for yourself.
Salathe is offline  
Reply With Quote
Old 03-03-2008, 01:24 AM   #10 (permalink)
how quixotic are you?
 
ETbyrne's Avatar
 
Join Date: Dec 2007
Location: Lapeer, MI
Posts: 445
Thanks: 37
ETbyrne is on a distinguished road
Default

Don't forget sprinf() and fprintf()!

You could also use include(), include_once(), require() , and require_once().
__________________
Dingo Web Systems > http://www.dingocode.com
My Website > http://www.evanbot.com
ETbyrne is offline  
Reply With Quote
Old 03-03-2008, 03:39 AM   #11 (permalink)
The Frequenter
 
Join Date: Dec 2007
Location: In my basement
Posts: 386
Thanks: 47
Aaron is on a distinguished road
Default

ummm
PHP Code:

#include <iostream.h> 
using namespace std
 
 
int main() 

  
cout << "Hello World"
  return 
0

Send a message via MSN to Aaron
Aaron is offline  
Reply With Quote
Old 03-03-2008, 06:22 AM   #12 (permalink)
The Frequenter
 
ReSpawN's Avatar
 
Join Date: Nov 2007
Location: Netherlands
Posts: 460
Thanks: 49
ReSpawN is on a distinguished road
Default

Quote:
Originally Posted by StevenF View Post
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"
Send a message via MSN to ReSpawN
ReSpawN is offline  
Reply With Quote
Old 03-12-2008, 05:30 PM   #13 (permalink)
The Prestige
Advanced Programmer Top Contributor Good Samaritan 
 
sketchMedia's Avatar
 
Join Date: Oct 2007
Location: Manchester, UK
Posts: 854
Thanks: 32
sketchMedia is on a distinguished road
Default

Quote:
Originally Posted by Aaron View Post
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)
sketchMedia is offline  
Reply With Quote
Old 03-13-2008, 01:36 PM   #14 (permalink)
Nor
The Addict
 
Join Date: Nov 2007
Posts: 282
Thanks: 61
Nor is on a distinguished road
Default

Quote:
Originally Posted by Salathe View Post
PHP Code:
Hello World
;) thats funny
__________________
PHP/XHTML Freelancer:
Cleanscript.com v3 - Programming starting at just $5 act now!
Nor is offline  
Reply With Quote
Old 03-13-2008, 10:33 PM   #15 (permalink)
The Visitor
 
Austin6641's Avatar
 
Join Date: Dec 2007
Posts: 1
Thanks: 0
Austin6641 is on a distinguished road
Default

There is always this:
PHP Code:
<?php
die("Hello World!");
?>
It would cause problems if you wanted to execute code after that though...
Austin6641 is offline  
Reply With Quote
Old 03-13-2008, 11:09 PM   #16 (permalink)
Orc
The Prestige
 
Orc's Avatar
 
Join Date: Dec 2007
Posts: 1,044
Thanks: 193
Orc is on a distinguished road
Default

PHP Code:
<?= "Hello World." ?>
__________________
VillageIdiot can have my babbies ;d
Orc is offline  
Reply With Quote
Old 03-14-2008, 01:41 PM   #17 (permalink)
The Frequenter
 
ReSpawN's Avatar
 
Join Date: Nov 2007
Location: Netherlands
Posts: 460
Thanks: 49
ReSpawN is on a distinguished road
Default

PHP Code:
<?php exit('TalkPHP'); ?>
__________________
"Life is a bitch, take that bitch on a ride"
Send a message via MSN to ReSpawN
ReSpawN is offline  
Reply With Quote
Old 03-25-2008, 06:43 PM   #18 (permalink)
The Wanderer
Good Samaritan 
 
martins256's Avatar
 
Join Date: Mar 2008
Posts: 18
Thanks: 0
martins256 is on a distinguished road
Default

PHP Code:
<?php
header 
("Content-type: image/png");
$im = @imagecreatetruecolor(5120)
      or die(
"Cannot Initialize new GD image stream");
$text_color imagecolorallocate($im255255255);
imagestring($im253,  "Talk"$text_color);
$text_color imagecolorallocate($im24612248);
imagestring($im2293,  "PHP"$text_color);
imagepng($im);
imagedestroy($im);
?>
martins256 is offline  
Reply With Quote
The Following User Says Thank You to martins256 For This Useful Post:
nefus (07-09-2009)
Old 03-26-2008, 01:47 AM   #19 (permalink)
Orc
The Prestige
 
Orc's Avatar
 
Join Date: Dec 2007
Posts: 1,044
Thanks: 193
Orc is on a distinguished road
Default

Quote:
Originally Posted by martins256 View Post
PHP Code:
<?php
header 
("Content-type: image/png");
$im = @imagecreatetruecolor(5120)
      or die(
"Cannot Initialize new GD image stream");
$text_color imagecolorallocate($im255255255);
imagestring($im253,  "Talk"$text_color);
$text_color imagecolorallocate($im24612248);
imagestring($im2293,  "PHP"$text_color);
imagepng($im);
imagedestroy($im);
?>
So simple yet, so good looking xD
__________________
VillageIdiot can have my babbies ;d
Orc is offline  
Reply With Quote
Old 04-28-2008, 05:27 AM   #20 (permalink)
The Addict
 
sarmenhb's Avatar
 
Join Date: Jan 2008
Location: los angeles
Posts: 309
Thanks: 44
sarmenhb is on a distinguished road
Default

Quote:
Originally Posted by Orc View Post
So simple yet, so good looking xD
wow i didnt know you can do that with php
__________________
no signature set
sarmenhb is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 10:45 AM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design