eduard Posted January 18, 2011 Share Posted January 18, 2011 What I don´t exactly understand in PHP: there are: input=variable?/output=echo or print? Link to comment Share on other sites More sharing options...
ShadowMage Posted January 18, 2011 Share Posted January 18, 2011 Input is typically data received from an HTML form via GET or POST. But I think I would also consider file data or database records input as well. Variables are just a means of referencing data, be it input or output.Output is typically done with echo or print, yes. Specifically, output is usually an HTML document, but could also be database records or files. Link to comment Share on other sites More sharing options...
jeffman Posted January 18, 2011 Share Posted January 18, 2011 To clarify. Any text in a PHP document that is not within <?php ?> tags will be output. (PHP can be structured so that this is not always the case, but you really have to know what you're doing.) This is in addition to echo and print statements within PHP tags. Link to comment Share on other sites More sharing options...
eduard Posted January 18, 2011 Author Share Posted January 18, 2011 To clarify. Any text in a PHP document that is not within <?php ?> tags will be output. (PHP can be structured so that this is not always the case, but you really have to know what you're doing.) This is in addition to echo and print statements within PHP tags.Does this mean that anything in the <?php ?> tags is input? Link to comment Share on other sites More sharing options...
eduard Posted January 18, 2011 Author Share Posted January 18, 2011 Input is typically data received from an HTML form via GET or POST. But I think I would also consider file data or database records input as well. Variables are just a means of referencing data, be it input or output.Output is typically done with echo or print, yes. Specifically, output is usually an HTML document, but could also be database records or files.Thanks! Link to comment Share on other sites More sharing options...
jeffman Posted January 18, 2011 Share Posted January 18, 2011 Does this mean that anything in the <?php ?> tags is input?No. Shadow's answer that you quoted in Post #5 pretty much covers the idea (add $_COOKIE, $_SESSION, $_FILES, and $_SERVER to the list.) Input is only available in the PHP tags, but that doesn't mean anything in the tags is input. Input is not something you write into your code. It is something external that your code has to receive. Link to comment Share on other sites More sharing options...
eduard Posted January 18, 2011 Author Share Posted January 18, 2011 No. Shadow's answer that you quoted in Post #5 pretty much covers the idea (add $_COOKIE, $_SESSION, $_FILES, and $_SERVER to the list.) Input is only available in the PHP tags, but that doesn't mean anything in the tags is input. Input is not something you write into your code. It is something external that your code has to receive.So, input is rational and the computer language it isn´t? Link to comment Share on other sites More sharing options...
ShadowMage Posted January 18, 2011 Share Posted January 18, 2011 So, input is rational and the computer language it isn´t?Can you rephrase that? I'm not sure I understand the question. Link to comment Share on other sites More sharing options...
boen_robot Posted January 18, 2011 Share Posted January 18, 2011 Input and output are very abstract terms...Input - anything that something receives.Output - anything that something gives (often based on the supplied input).Anything between "<?php" and "?>" is input to the PHP interpreter from you - the developer.Anything in $_POST, $_GET, $_COOKIE is input to your PHP code from the user's (HTTP) request.Anything not between "<?php" and "?>" is part of the ouput from the PHP interpreter. Link to comment Share on other sites More sharing options...
eduard Posted January 18, 2011 Author Share Posted January 18, 2011 Input and output are very abstract terms...Input - anything that something receives.Output - anything that something gives (often based on the supplied input).Anything between "<?php" and "?>" is input to the PHP interpreter from you - the developer.Anything in $_POST, $_GET, $_COOKIE is input to your PHP code from the user's (HTTP) request.Anything not between "<?php" and "?>" is part of the ouput from the PHP interpreter.Thanks!(I wished I had had you as my teacher!) Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.