Hello,
I am curious if there is a solution for the following in PHP4:
I often echo something to my browser during tests. I often forget to add a
<BR> to the end of the echo command.
Is it possible to use something like a mcro in C++ to have a command I can
use like echo but which automatically adds the <br> ?
Or is there a command that does that for me ?
Alternatively I could write a function of course, but then brackets come in
to play as well.
TIA
Pjotr 6 7221
Pjotr Wedersteers wrote: Hello,
I am curious if there is a solution for the following in PHP4: I often echo something to my browser during tests. I often forget to add a <BR> to the end of the echo command. Is it possible to use something like a mcro in C++ to have a command I can use like echo but which automatically adds the <br> ? Or is there a command that does that for me ? Alternatively I could write a function of course, but then brackets come in to play as well.
There are several ways. Easiest would be to use nl2br()
HTH
C.
Colin McKinnon wrote: Pjotr Wedersteers wrote:
Hello,
I am curious if there is a solution for the following in PHP4: I often echo something to my browser during tests. I often forget to add a <BR> to the end of the echo command. Is it possible to use something like a mcro in C++ to have a command I can use like echo but which automatically adds the <br> ? Or is there a command that does that for me ? Alternatively I could write a function of course, but then brackets come in to play as well.
There are several ways. Easiest would be to use nl2br()
HTH
C.
Thanks. But this is as "cumbersome" as writing a simple function echobr ();
I decided to try the following -a constant- for a while. Maybe someone likes
it or has better ideas.
Define ("br","<br>");
echo "Mystring or whatever".br;
Another advantage is I can easily change all breaks to newlines and vice
versa when I am working in my PHP ide, which doesn't display breaks
properly.
Pjotr
Pjotr Wedersteers wrote: Colin McKinnon wrote:
Pjotr Wedersteers wrote:
Hello,
I am curious if there is a solution for the following in PHP4: I often echo something to my browser during tests. I often forget to add a <BR> to the end of the echo command. Is it possible to use something like a mcro in C++ to have a command I can use like echo but which automatically adds the <br> ? Or is there a command that does that for me ? Alternatively I could write a function of course, but then brackets come in to play as well.
There are several ways. Easiest would be to use nl2br()
HTH
C.
Thanks. But this is as "cumbersome" as writing a simple function echobr (); I decided to try the following -a constant- for a while. Maybe someone likes it or has better ideas. Define ("br","<br>"); echo "Mystring or whatever".br; Another advantage is I can easily change all breaks to newlines and vice versa when I am working in my PHP ide, which doesn't display breaks properly.
....but then you still have to *remember* to put it in... ;)
--
Justin Koivisto - sp**@koivi.com
PHP POSTERS: Please use comp.lang.php for PHP related questions,
alt.php* groups are not recommended.
On Tue, 03 Aug 2004 20:22:32 +0200, Pjotr Wedersteers wrote: Thanks. But this is as "cumbersome" as writing a simple function echobr (); I decided to try the following -a constant- for a while. Maybe someone likes it or has better ideas. Define ("br","<br>"); echo "Mystring or whatever".br; Another advantage is I can easily change all breaks to newlines and vice versa when I am working in my PHP ide, which doesn't display breaks properly. Pjotr
Yikes!
To me:
echo 'my string<br />'
is a lot more simple than having to use concatenation and a constant.. and
probably uses less resources (no define) although this would obviously be
too small to physically notice =)
Using .CONST would be the m$ approach IMO.. "screw standards, I gotz me an
idea!"
Regards,
Ian
--
Ian.H
digiServ Network
London, UK http://digiserv.net/
Ian.H wrote: On Tue, 03 Aug 2004 20:22:32 +0200, Pjotr Wedersteers wrote:
Thanks. But this is as "cumbersome" as writing a simple function echobr (); I decided to try the following -a constant- for a while. Maybe someone likes it or has better ideas. Define ("br","<br>"); echo "Mystring or whatever".br; Another advantage is I can easily change all breaks to newlines and vice versa when I am working in my PHP ide, which doesn't display breaks properly. Pjotr
Yikes!
To me:
echo 'my string<br />'
is a lot more simple than having to use concatenation and a constant.. and probably uses less resources (no define) although this would obviously be too small to physically notice =)
Using .CONST would be the m$ approach IMO.. "screw standards, I gotz me an idea!"
Eeek, you say I'm infected with m$ virus.. What's my penance for this sin ?
But seriously, the problem is mostly when I don't echo strings but numerals,
without those nasty quotes. I am a lazy typist.
And echo $a.br; types faster than echo $a."<br />";
On Tue, 03 Aug 2004 23:36:24 +0200, Pjotr Wedersteers wrote: Using .CONST would be the m$ approach IMO.. "screw standards, I gotz me an idea!"
Eeek, you say I'm infected with m$ virus.. What's my penance for this sin ? But seriously, the problem is mostly when I don't echo strings but numerals, without those nasty quotes. I am a lazy typist. And echo $a.br; types faster than echo $a."<br />";
Fair play, can see the extra work here (I'm a lazy typist too =) ).
In Zend, I can hit ctrl+enter and it'll insert a <br> for me.. apologies
if you've already said, but what editor are you using? I wrote many macros
for UEdit to add GPL / BSD headers and other small comment snippet inserts
etc to save myself time.. if your editor has this function it'd be
a trivial task I'm assuming =)
Just a thought.
Regards,
Ian
--
Ian.H
digiServ Network
London, UK http://digiserv.net/ This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Andrew Dalke |
last post by:
Here's a proposed Q&A for the FAQ based on a couple recent
threads. Appropriate comments appreciated
X.Y: Why doesn't Python have macros like in Lisp or Scheme?
Before answering that, a...
|
by: mike420 |
last post by:
I think everyone who used Python will agree that its syntax is
the best thing going for it. It is very readable and easy
for everyone to learn. But, Python does not a have very good
macro...
|
by: Pete |
last post by:
In Access 95/97 I used to be able to create pull down menus (File,Edit
...) from a macro. It seems there used to be some wizard for that.
However in Access 2000 it seems you have to build your...
|
by: Newbie_sw2003 |
last post by:
Where should I use them?
I am giving you my understandings. Please correct me if I am wrong:
MACRO:
e.g.:#define ref-name 99
The code is substituted by the MACRO ref-name. So no overhead....
|
by: Alexander Ulyanov |
last post by:
Hi all.
Is it possible to pass the whole blocks of code (possibly including
" and ,) as macro parameters?
I want to do something like:
MACRO(FOO, "Foo",
"return "Foobar";",
"foo();...
|
by: lasek |
last post by:
Hi...in some posts i've read...something about using macro rather then
function...but difference ??.
Best regards....
|
by: Laurent Deniau |
last post by:
I was playing a bit with the preprocessor of gcc (4.1.1). The following
macros expand to:
#define A(...) __VA_ARGS__
#define B(x,...) __VA_ARGS__
A() -nothing, *no warning*
A(x) -x
...
|
by: Takeadoe |
last post by:
Dear NG,
Can someone assist me with writing the little code that is needed to
run an update table query each time the database is opened? From what
I've been able to glean from this group, the...
|
by: Bill |
last post by:
This database has no forms. I am viewing an Access table in datasheet
view. I'd like to execute a macro to execute a function (using
"runcode"). In the function, I'll reading data from the record...
|
by: =?Utf-8?B?TGV0emRvXzF0?= |
last post by:
I'd like to create a Macro that will sort some raw data, apprx 20k lines,
remove some lines based upon a condition in a certain column. Then copy this
data into a new spreadsheet and sort the ...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |