TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   Tips & Tricks (http://www.talkphp.com/tips-tricks/)
-   -   Outputting data without print/echo (http://www.talkphp.com/tips-tricks/2386-outputting-data-without-print-echo.html)

ReSpawN 04-28-2008 06:45 AM

Search the web for GD library. And uh, why start a silent command (@imagecreatetruecolor) and then call up the or die ("..") function...? Couldn't you then just better $im = @imagecreatetruecolor(...); if (!$im) { exit('DieCommand'); }

sketchMedia 04-28-2008 10:54 AM

PHP Code:

die(chr(0x54) . chr(0x61) . chr(0x6C) . chr(0x6B) . chr(0x70) . chr(0x68) . chr(0x70)); 


Kalle 05-22-2008 01:41 PM

HTML Code:

<p>Hello TalkPHP!</p>
=P

ReSpawN 05-22-2008 06:28 PM

*sigh* ...

Didn't see this one yet.
PHP Code:

die('Bye Bye TalkPHP'); 


delayedinsanity 05-22-2008 07:42 PM

Quote:

Didn't see this one yet.
You beat yourself to it by using exit() earlier, but this person also did. ;)

http://www.talkphp.com/tips-tricks/2...html#post12378

Kalle 05-23-2008 10:31 AM

As in response to ReSpawN's exit() code:
You can't use exit()'s parameter to specify a shutdown message, thats why we have die(). exit()'s parameter is an integer that tells the shutdown code.

exit(0); means that the program shutdown correct just like in C++:

Code:

int main()
{
        return 0;
}

;-)

Salathe 05-23-2008 11:39 AM

exit can take a string argument (in place of the usual integer). If the argument is a string, it gets printed just before exiting just like with die. Try it. :-)

Jim 05-23-2008 12:53 PM

Hai
Can Has Stdio?
Visible "hai Talkphp"
Kthxbye

TexasMd91 06-12-2008 08:27 PM

By typing it...

Never said it had to be in PHP. XD

Village Idiot 06-25-2008 03:18 PM

PHP Code:

$im = @imagecreatefromJPEG("bg.jpg");
$black imagecolorallocate($im000);
imagestring($im352"Hello TalkPHP"$black);
header("content-type: image/jpeg");
echo 
imagejpeg($im);
imagedestroy($im); 


Oilik 07-27-2008 04:11 PM

Quote:

Originally Posted by Jim (Post 14840)
Hai
Can Has Stdio?
Visible "hai Talkphp"
Kthxbye

xD lolcode. :P


Mah way of outputting data without using echo/print:
PHP Code:

<?php
system
("echo wut");
?>

...hey i didn't use php's echo. :(

Dr_Neffy 08-22-2008 06:40 AM

PHP Code:

<?php
$a 
= array("TalkPHP Rulez\n");
print_r($a);
?>

or with a system and without any echo or print
PHP Code:

<?php
system
("perl -e 'printf `hi TalkPHP\n`'");
?>

(lol)

wiifanatic 08-23-2008 12:25 AM

Code:

document.write('O HAI');

rune_kg 08-23-2008 08:03 AM

The same, but different
 
<?=`echo Hello_World`?>

zendkush 08-26-2008 08:32 AM

Use a java bridge!
Code:

// action handler to fill button
function clicked($sender, $e) {
  $win = new Mono("Gtk.Window", "phpinfo()");
  $win->set_DefaultWidth(640);
  $win->set_DefaultHeight(400);
  $pane = new Mono("Gtk.ScrolledWindow");
  $view = new Mono("Gtk.TextView");
  $buffer = new Mono("Gtk.TextBuffer", new Mono("Gtk.TextTagTable"));
  ob_start();
  phpinfo();
  $buffer->set_Text(ob_get_contents());
  ob_end_clean();
  $view->set_Buffer($buffer);
  $pane->add($view);
  $win->add($pane);
  $win->ShowAll();
 }
 $btn = new Mono("Gtk.Button", "Show output from phpinfo()");
 $btn->add_Clicked(new Mono(
                                "System.EventHandler",
                                mono_closure($this, "clicked")));
// then send button to window.


zspencer 09-02-2008 06:04 PM

Howzabout some Error Tossing
 
PHP Code:

<?
ini_set
('display_errors','on');
error_reporting(E_ALL);
trigger_error('Woah, error d00d',E_USER_NOTICE);
?>

What? It works. You can even execute stuff after it too :-D

Ross 09-02-2008 08:16 PM

PHP Code:

file_put_contents('error.html''<p>error\'d</p>');

$ch curl_init('error.html');
// explanatory line
curl_setopt($chCURLOPT_RETURN_TRANSFERfalse);
curl_exec($ch); 


Village Idiot 09-10-2008 03:14 AM

C++
Code:

#include <stdlib.h>
#include <fstream>
using namespace std;
int main()
{
    fstream file_op("test.txt",ios::out);
    file_op<<"Hello World";
    file_op.close();
    system("test.txt");
    return 0;
}

Only tested on windows XP, but should run cross platform.

sketchMedia 09-10-2008 10:52 AM

I can confirm it compiles on linux, although you may need to change the line:
cpp Code:
system("test.txt");
to something like
cpp Code:
system("cat test.txt");//cat vi nano whatever
 
so linux knows what to do with it.

in a similar vein, heres ruby:
ruby Code:
File.open('test.txt', 'w') {|f| f.write("Hello World \n\r") }
exec("cat test.txt")

erect 12-02-2008 09:59 PM

how about breaking out of php and just getting the html to output?

PHP Code:

?>text to this page<?

no echo's or print's involved


All times are GMT. The time now is 04:20 AM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0