Professional Web Applications Themes

echo statements - PHP Development

When echoing html code that will include variables from a while or if loop, which method is best? Method 1: echo "<td align=\"left\" VALIGN=\"top\"><font class=\"dbtables\">$employer</font></td>"; OR Method 2: <td align="left" valign="top"><font class="dbtables"><?php echo "$employer"; ?></font></td> If you would, please give reasons why to support your opinion. Thanks -- Jay Fitzgerald, Design Director - CPW-A, CPWDS-A, CPWDV-A, CECM-A, CWCSB-A Bayou Internet - [url]http://www.bayou.com[/url] Toll Free: 888.30.BAYOU (22968) Vox: 318.338.2034 / Fax: 318.338.2506 E-Mail: [email]jayfitzbayou.com[/email] ICQ: 38823829 / AIM: bayoujf / MSN: bayoujf / Yahoo: bayoujf...

  1. #1

    Default echo statements

    When echoing html code that will include variables from a while or if loop,
    which method is best?
    Method 1: echo "<td align=\"left\" VALIGN=\"top\"><font
    class=\"dbtables\">$employer</font></td>";
    OR
    Method 2: <td align="left" valign="top"><font class="dbtables"><?php echo
    "$employer"; ?></font></td>
    If you would, please give reasons why to support your opinion.
    Thanks

    --
    Jay Fitzgerald, Design Director - CPW-A, CPWDS-A, CPWDV-A, CECM-A, CWCSB-A
    Bayou Internet - [url]http://www.bayou.com[/url]
    Toll Free: 888.30.BAYOU (22968)
    Vox: 318.338.2034 / Fax: 318.338.2506
    E-Mail: [email]jayfitzbayou.com[/email]
    ICQ: 38823829 / AIM: bayoujf / MSN: bayoujf / Yahoo: bayoujf

    Jay Fitzgerald Guest

  2. #2

    Default Re: [PHP] echo statements

    --- Jay Fitzgerald <jayfitzbayou.com> wrote:
    > When echoing html code that will include variables from a while or
    > if loop, which method is best?
    ....
    > Method 1: echo "<td align=\"left\" VALIGN=\"top\"><font
    > class=\"dbtables\">$employer</font></td>";
    > OR
    > Method 2: <td align="left" valign="top"><font class="dbtables"><?php echo
    >"$employer"; ?></font></td>
    Method 2 is my choice.
    > If you would, please give reasons why to support your opinion.
    Readability and performance.

    Chris

    =====
    Become a better Web developer with the HTTP Developer's Handbook
    [url]http://httphandbook.org/[/url]
    Chris Shiflett Guest

  3. #3

    Default Re: [PHP] echo statements

    Jay Fitzgerald <jayfitzbayou.com> wrote:
    > When echoing html code that will include variables from a while or if loop,
    > which method is best?
    > Method 1: echo "<td align=\"left\" VALIGN=\"top\"><font
    > class=\"dbtables\">$employer</font></td>";
    > OR
    > Method 2: <td align="left" valign="top"><font class="dbtables"><?php echo
    > "$employer"; ?></font></td>
    method 2a:
    <td class="dbtables"><?php echo $employer?></td>
    > If you would, please give reasons why to support your opinion.
    > Thanks
    >
    - readability
    - less typing
    - easier to type no \" or if using ' and " together when to use one or
    the other... etc etc etc....
    - code is easier to read
    - never use the font tag.. bad.. evil...


    Curt
    --

    Curt Zirzow Guest

Similar Threads

  1. CGI::Echo V 1.04
    By Ron Savage in forum PERL Modules
    Replies: 0
    Last Post: July 29th, 06:13 AM
  2. #24787 [Bgs]: one out two echo-statements results in output
    By per dot funke at ub dot oru dot se in forum PHP Development
    Replies: 0
    Last Post: July 24th, 08:31 PM
  3. #24787 [Opn->Bgs]: one out two echo-statements results in output
    By sniper@php.net in forum PHP Development
    Replies: 0
    Last Post: July 24th, 11:14 AM
  4. #24787 [Opn]: one out two echo-statements results in output
    By meebey@php.net in forum PHP Development
    Replies: 0
    Last Post: July 24th, 08:18 AM
  5. Replies: 2
    Last Post: July 12th, 06:13 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139