here a typecast? Keep in mind that
a typecast may be hidden - you don't have to explicitly typecast { $var
= (int)$var } to get this effect. It could be implicit with a function
call, etc.
--Toby Butzon
David Robley wrote:
>
> On Wed, 4 Apr 2001 15:44, Vlad wrote:
> &g
o, in what version did this first
appear?
Thanks,
--Toby Butzon
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]
You can also use PHP for shell scripting - just add #!/path/to/php -q as
the first line of your script.
Note: You will still need to enclose all PHP scripting in
tags.
Here's an example:
file: phpinfo.phpshell
The preceding information was returned by PHP info.
[EOF]
Then run the followi
Just use \n. Both OS's understand this to be a linefeed and will behave
accordingly.
With the exception of a class that performs POP3 queries, I've never had
to use \r\n in my code.
Regards,
Toby Butzon
Todd Cary wrote:
>
> When I write to a file with PHP, I get double l
Trim should do exactly what you're looking for without needing
ereg_replace, etc.
Trim trims all whitespace before the first non-whitespace character and
after the last non-whitespace character. I've included an example and
its output below.
File: test.php
Output: test.php
' This is my te
> Trim() will in fact only strip whitespace from the beginning or end of
> the string; if he has \n's anywhere in the middle of the string, trim
> will do perform the desired operation.
CORRECTION : "trim will not perform the desired operation"
--
PHP General Mailing List (http://www.php.net/
Trim() will in fact only strip whitespace from the beginning or end of
the string; if he has \n's anywhere in the middle of the string, trim
will do perform the desired operation.
Ereg_replace() is unnecessary for a simple search/replace operation;
str_replace() will suffice and is faster to some
Change the name of your select to "test[]" instead of "test", then
access it like an array:
foreach($test as $current) {
echo "$current was selected\n";
}
--toby
Pablo Martin De Natale wrote:
>
> Hello, I'm trying to make a multiple select...
>
> I've this code...
>
>
> 1
> 2
> 3
>
>
>
Try include_once() for your includes instead of simply include().
--toby
Matt Williams wrote:
>
> >
> > This has been an ongoing problem, when I include a file which contains a
> > call to a function I get undefined function errors but when I try
> > to include
> > the file containing the funct
Yes, you can return false.
As for "true booleans", PHP doesn't really have a boolean type - it does
have a sense of "true" and "not true" though. You can return false (a
case-insensitive constant with the value 0) or true (whose value is
probably 1 but could really be anything other than 0 or th
I've read that several times... so does that mean now the only debugger
for PHP4 is the Zend one?
--toby
Chris Lee wrote:
>
> You must be viewing old documentation.
>
> http://php.net/manual/en/debugger.php
>
> clearly states that debugger, ie debugger_on() support is in php3 only, not
> in p
Check out php.net/round and it's relatives
--Toby
LDL Enterprise wrote:
>
> I am having trouble getting this peice of code to only show 2 decimal
> places.
>
> echo $cart->cart_total($table, $scid) * .0625;
>
> The class returns 100.50 and the above code returns 6.28125
>
> Any help taking t
Greetings,
I was just wondering if there's a "proper" name for what I've been
calling the "short equals tag" ( http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]
Nope, this won't work. PHP is stricly server side; only JavaScript and
other client side languages are capable of being called based on an
event (as opposed to an HTTP request).
--toby
Francesco Rossi wrote:
>
> Hi,
> How i can use the event OnChange of a tag for run a php script ?
> Es.
> Th
Umm, not sure I understand the question completely... but following the
code below, why not just assign the object to a new variable? That'd
give you an exact copy with a lot less code...
--toby
Richard Lynch wrote:
>
> > I'm wondering if there is an easy way to code a generic cloner at to
You might find more help on php-windows, but here's what I suspect...
Take a look at your IIS management console and see if the subdirectory
might've been configured differently from the root directory. Or, try
changing the script mappings a little in the root and let them override
the subdirecto
Or you might try a foreach($array as $element)... about the same but it
doesn't give you they key - just the value (as $element).
foreach ($email as $current) {
// process this email addr
} // move on to the next one until the whole arr of them has been proc'd
Good luck-
--Toby
David Robley
I gotta agree here. It happens every once in a while and it usually
turns out to be something like that... also check to see if you have any
here-docs in there that aren't terminated correctly (the ending signal
must appear at the first column of a line and be followed by a
semicolon). I don't kno
I agree. It's a great reference & learning guide, but you _have_ to be
patient and not skip around too much with it or it'll be quite
intimidating.
--Toby
[EMAIL PROTECTED] wrote:
>
> On Sun, Feb 04, 2001 at 05:06:02PM -0600, Jeff Oien wrote:
> > What would your advice be for learning MySQL wit
> > As for better OO. I think many of the things people ask for, like
> > visibility (public,private,protected) class properties, aren't actually
> > features that add functionality, but more just convenience features
> > that could be implemented in user space.
>
> I disagree. Just as with stro
Yes, system() waits for the called program to terminate before PHP
execution continues, so that should work.
However, you may also want to look into building a custom module for PHP
so you can call your C functions directly from PHP. Info on the Zend
API, building PHP modules in C, etc., is avail
changed anything as far as the
scripting on the page goes. I've tried rebooting (seems a likely
solution for windows, but it didn't work :/), I upgraded to the latest
PHP (I had been running 403), and even using the ISAPI module instead of
the CGI...
My apologies if it's obv
Make the form page post to itself and use default values of . The initial form will be blank, but
subsequent failing attempts will have the values the visitor already
entered. You can also add red text to the form to show what exactly was
wrong, etc.
Then, to handle posts that are successful, you
This isn't going to work the way it's set up now. Javascript is
processed by the visitor's browser, while PHP is processed by the server
before the page is ever sent.
So in essence, PHP doesn't care one bit what anything outside of the
tags does. Therefore, you're instructing PHP to do this:
ma
I'll step through the following snippet - maybe it'll give you a clearer
explaination.
> $foo = 'Bob'; // Assign the value 'Bob' to $foo
> $bar = &$foo; // Reference $foo via $bar.
> $bar = "My name is $bar"; // Alter $bar...
> echo $foo;
Yea, it's true. There was a post a couple of weeks ago from Rasmus
(IIRC) that explained the reasoning: the [] form is used on strings and
arrays, so PHP has to figure out which one it's dealing with before it
can return a result. If $myAr[] and $myStr{} are seperate, the
interpretter will know in
I'm not sure if I'm understanding correctly, but you might
take a look at this modification...
Notice: all lines with a > in front of them have remained
unchanged. Lines that can safely be deleted are preceeded by
single-line comments (//), and lines without a > are newly
added lines.
$allFields
You may need to check your mail server's error logs and see if
something's happening there. Assuming PHP _is_ finding the mail server
and attempting to send the message, there must be some problem at the
mail server (ie, no relay access for the IP where your script is
running, etc.).
--Toby
TraX
The -> operator is used with class objects. See the manual
section on classes & objects ;)
The <<< is used with here-doc strings. I believe you'll find
it in the strings section of the manual.
Examples:
$myObj = new myClass;
$myObj->somevar = "This is some var";
$str = <<
To: <[EMAIL PROTECTED]
Hmm... that may work for what you're trying to do and it may
not... if your string contains something like this:
$str = <
Enable track_vars in php's config and use
$PHP_COOKIE_VARS['cookie_id'] to get the value of the
cookie.
--Toby
- Original Message -
From: "April" <[EMAIL PROTECTED]>
To: "PHP General" <[EMAIL PROTECTED]>
Sent: Wednesday, January 24, 2001 5:06 PM
Subject: [PHP] Cookie semi-security.
> S
> >One thing that occurs to me -- stdout starts off by being
the browser, so
> >it's kinda funky to open it -- You've already got it
open... I *think* it
> >really only makes sense to fopen() stdout from the
command line. At least,
> >I'm not clear on what it would mean to open it from a
HTTP en
Just when this thread seems to die it comes back...
Perhaps the PHP page should have a page of editors with
feature lists/ups & downs to each editor... a little
research & a public page by one person (and maybe
intermittent updates; moderated feedback might also be good)
would save us from even a
That's the truth. PHP started out as a set of "Personal Home Page tools"
(1st version), then PHP/FI (PHP + form interpretter [or something similar -
I'm not sure 'form interpretter' is completely correct, but that was
basically the functionality of the FI portion])... anyway, then sometime
during
Do just what you said and create a directory outside of your Apache doc
root. Just make sure the user PHP is running as has permissions to access
the directory ;) Then use PHP's fpassthru, etc., to send the content of the
file back.
You will need to send a mime-type header; take a look around - t
Might want to check out fpassthru (http://www.php.net/fpassthru).
Good luck -
--Toby
- Original Message -
From: "Mike Chambers" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, January 22, 2001 12:20 AM
Subject: [PHP] writing a binary file to a browser
> I am trying to open a
What were you doing compiling binaries? Are you referring to mysql or php
when you say you tried to compile? What OS?
--Toby
- Original Message -
From: "Chris" <[EMAIL PROTECTED]>
To: "Phil Driscoll" <[EMAIL PROTECTED]>; "PHP"
<[EMAIL PROTECTED]>
Sent: Wednesday, January 17, 2001 10:46 P
You might try this:
Arguments for mktime for my reference and for yours are ...
int mktime (int hour, int minute, int second, int month, int day, int year
[, int is_dst])
Then put it together with date() like this...
date("t", mktime(1, 1, 1, $mm, 1, $));
This is untested, but should work
Plus if you're just looking for soemthing to get your layout started, you
can start in FrontPage and just never open PHP files in it once you start
adding PHP ;)
--Toby
- Original Message -
From: "Ignacio Vazquez-Abrams" <[EMAIL PROTECTED]>
To: "Murph" <[EMAIL PROTECTED]>
Cc: <[EMAIL PRO
Has using
To: "Alexander Wagner" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Thursday, January 18, 2001 4:21 PM
Subject: Re: [PHP] On Thu, Jan 18, 2001 at 10:02:42PM +0100, Alexander Wagner wrote:
> > [EMAIL PROTECTED] wrote:
> > > > > > > > >
> > > And for all three cases the closing tag
Take a look at the changes I made to your original post; this assumes that
the file isn't there until results are posted - hope that's the case ;)
--Toby
> http://www.ourheadoffice.co.nz/results/race01.html",
"r")) {
> $rf = fread($file, 20);
> $grab = eregi("(.*)", $rf, $printing);
> fclose
:) Ok you and John win ;) Probably shoulda kept my yap shut...
--Toby
- Original Message -
From: "Egan" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, January 17, 2001 6:16 PM
Subject: Re: [PHP] phpwebhosting.com
> On Wed, 17 Jan 2001 18:
> 125 users at $10 per month, is a maximum revenue of $1,250 per month
> per server. From that meager revenue, they are able to provide their
> customers with an OC-12. I would like to meet the genius who is able
> to pull that financial rabbit out of a hat!
...and one machine is chewing up a w
al Message -
From: "Jens Rehpöhler" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: "Toby Butzon" <[EMAIL PROTECTED]>
Sent: Wednesday, January 17, 2001 1:05 PM
Subject: Re: [PHP] Change the session timeout within a php-script
> I think you underst
> > Is PHP the implied script, so that it is okay to begin PHP code like
this > vs. like this > When is it not implied?
>
> You should use dropped or your administrator can disable the open short tag.
Are there in fact plans to drop the short tags?
--Toby
--
PHP General Mailing List (http
ley <[EMAIL PROTECTED]> pgp keyid 0xAECBA355
> Phil 1:21 www.ganooz.com
> Car pour moi, la vie c'est le Christ, et la mort est un gain.
>
> > -Original Message-
> > From: Toby Butzon [mailto:[EMAIL PROTECTED]]
&g
This all depends on your include_path set in the PHP config files; see the
manual section on config for more info.
About the security hole... yes it would be dangerous on a system where
accounts are given to untrusted users (ie, customers), but there are ways
to make PHP secure for multi-account
Nope. EditPlus is Windows-only.
--Toby
- Original Message -
From: "Scott Gerhardt" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; "Php-General-Digest"
<[EMAIL PROTECTED]>; "Chris Aitken" <[EMAIL PROTECTED]>
Sent: Wednesday, January 17, 2001 11:54 AM
Subject: RE: [PHP] I love/hate FrontPage
set_time_limit($seconds)
--Toby
- Original Message -
From: "Jens Rehpöhler" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, January 17, 2001 9:02 AM
Subject: [PHP] Change the session timeout within a php-script
> Hi,
>
> is it possible to change the session timeout from wi
> echo foo(dog);// outputs "This is a dog"
This is an example of using a "bareword" - PHP doesn't recognize _dog_ as
any sort of reserved word or constant, so it sends it like a quoted string.
I don't recommend using this because it's ambiguous whether you mean "dog"
or if _dog_ is a cons
> displayed, I want to change the search query so it stands out in the
result
> list. I'm just using...
> ereg_replace($search_query, "$search_query", $row[6]);
> ...at the moment, but it wont match results where the case doesn't match.
Try eregi_replace...
php.net/eregi_replace
--Toby
--
PH
> Example ONE: (in just parse mode)
> [cut]---
> print "blah blah blah blah blah blah blah";
> print "" . $Var1 . "" . $Var2 . "";
> ?>
> [/cut]--
Ran a pretty rough benchmark: 10040 lines of code (5020 repetitions of the
above example) 10 times with an a
A sincere "thank you" to James ;) I completely agree.
I thought about saying something but I'm so sick of the editor wars I
decided not to...
--Toby
- Original Message -
From: "James McLaughlin" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, January 16, 2001 10:53 PM
Subject
You could loop it with foreach (which I think is the same way Perl handles
the ex you gave).
foreach ($myArr as $myStr) {
$myStr = ereg_replace($regexp, $myStr);
}
Note quite "one statement", but if you really wanted to shorted it (and in
the opinion of most sacrafice readability), you could
Have you tried adding
or die(mysql_error())
to try and let mysql tell you what's wrong? That and the
previously-suggested echo-ing the SQL statement solve most of my problems.
--Toby
- Original Message -
From: "Christopher Allen" <[EMAIL PROTECTED]>
To: "Sam Masiello" <[EMAIL PROTECTED
Works for me... what version of PHP are you using?
--Toby
- Original Message -
From: "Dhaval Desai" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, January 16, 2001 7:56 AM
Subject: [PHP] is 1 a Variable...Discoverd it just now...
>
> HI!
>
>
> When I run the foillowing code
> Well it's up to you wether or not to encrypt passwords, but it's very
> irresponsible not to. If somebody cracks your system, chances are
> they'll get passwords that can be used on accounts your users have
> in other places, so your customers suffer more than they should for
> your lax in secur
I would guess the passwords are stored in plain text... on a dedicated
machine, this is only as much of a risk as the machine's security in
general is... still more of a risk than I'd take with data that needs to be
secure...
As someone mentioned earlier, if you want to provide for a user who mig
Note that base64 encode/decode keeps passwords from being readily readable
but does NOT protect anything from being decoded. The reason you can't
decode Password and MD5 encrypted passwords is that if you could, all you'd
have to do is find the encrypted version and decrypt it. Again, _anybody
can
My fault for missing the original post... but if this is the discussion I
think it is...
I'd say if you've already got one language under your belt you can probably
learn PHP without too much trouble just by reading the first few chapters
of the manual and using the function reference beyond that
kes no difference for this example; just
my personal pref to stick with echo).
Regards,
--Toby
- Original Message -
From: "Toby Butzon" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Monday, January 15, 2001 12:35 PM
Subject: Re: [PHP
First of all check this:
print(stripslashes("$num[sub]"));
... should be...
print(stripslashes($num['sub']));
That will change the result, but I don't know if it's the result you're
going for...
One other note of interest... why is your variable named $num? If it was
supposed to be a significan
This has been discussed before; you should probably check the archives (see
php.net/support.php for list of archives; one archive can be found at
marc.theaimsgroup.com).
--Toby
- Original Message -
From: "TOM" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, January 15, 2001 2:3
I think the ! might have an effect on the regexp interpretter... it's easy
enough to escape it (\!) though.
--Toby
- Original Message -
From: "Jason Murray" <[EMAIL PROTECTED]>
To: "'Romulo Roberto Pereira'" <[EMAIL PROTECTED]>; "php-general"
<[EMAIL PROTECTED]>
Sent: Sunday, January 14,
Please note:
The php-dev list is for developers of PHP (who create/maintain PHP, which
is written in C); questions about programming in PHP should be addressed to
[EMAIL PROTECTED] For more information, please see
php.net/support.php.
---shifted to php-general from php-dev---
> I would like to as
I like this one and I think I'll comment on it...
> > can people give me opinions as to why
> a. PHP4 specific
> b. Many do not know what it is / what it does
> c. Will not work when short_tags are disabled
> d. Does not follow PEAR standards (ed. guess)
> e. Looks funny / weird / out
town%'
>
> How different are they? I'm not even sure what a wildcard is?
A wildcard is a character that can be used to represent any character (or
any set of any character). For instance, on many operating systems the *
wildcard represents what you could call "anythin
You've basically got it... the advantage of LIKE is that you can add
wildcards to specify what can be different...
towns = '$town'
...and...
towns LIKE '$town'
...are essentially the same without the % wildcard character. Thus,
towns = '$town'
...is much different than...
towns LIKE '%$town%'
Please note that php-dev is for the developers of PHP, not
scripting in PHP.
With that said, you have posed a good question. To keep my
description brief, comments do not hinder source code
processing time enough to be considered detrimental.
My limited explaination:
They save enough time otherw
Take a look at
http://www.php.net/manual/en/language.basic-syntax.php.
Regarding the use of . (The .)
The use of <%= is discouraged (as is <%) because it was only
added to make things easier for ASP devels and people
working in FrontPage.
The use of
> Can someone point me to the documentation
This is a matter of figuring out why the variable isn't a
valid file handle resource. To do so, find where it should
be made such a resource (the line that says $fp =
fsockopen...etc... is probably it), and add some error
checking. I believe this function has its own way of
returning what's wrong;
Manual suggests 3.0.3, but I can't find any proof of it in
the changelogs...
--Toby
- Original Message -
From: "Richard Lynch" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, January 11, 2001 6:34 PM
Subject: Re: [PHP] > when was
> Definitely before that -- Not sure when.
>
>
Look into output buffering (ob_* functions). You wouldn't
want to do that with your whole script; but there is an
example (if not in the manual it's on zend I believe) so you
can assign the results (what would've been outputted to the
browser without the buffering) to a variable.
--Toby
- Or
I notice this is kinda getting pushed towards other
directions and the reasons for keeping the direction asked
for seem to have merit, so...
It can be done, I'm sure, but you'll have to sit down and
design it... you'll probably be better off using a package
that already does such things. You've g
> $file should be the name of the file - there is a PHP
variable for this but
> I'm drawing a blank right now.
How about __FILE__ ? ;)
Note: it's a constant, so make sure you don't try to use a $
before it
--Toby
- Original Message -
From: "Joe Stump" <[EMAIL PROTECTED]>
To: "Kurth Bem
Come on... mixing PHP and HTML in the same file isn't bad
style... in fact it can make things easier to read, if you
do it right.
This is one of PHP's biggest features... otherwise we'd just
have another Perl...
...my .02...
--Toby
- Original Message -
From: "Alexander Wagner" <[EMAIL
[about experimenting with php on win95/98]
O, ok. Then the part you're missing is a webserver...
Xitami's good for win95/98 (see www.imatix.com), though I
haven't used it for a couple of years, so I don't know if
it's as good as it used to be (chances are, it is ;))...
also, a lot of people prefer
> Is there a PHP simulator for NT? One that can be used for
testing and
> development?
Generally a staging/development server is the way to go
about testing... just set up a server that duplicates the
environment of the server you'll eventually be using... ie,
install PHP with the same options..
This reminded me of an issue I've kind of been contemplating
for a couple of weeks now... I got sick of having to
connect, query, check for errors, etc. every time I wanted
to query a mysql database, so I wrote a function to do all
of it for me... something like:
function query_db($queryString, $
You can do it in PHP, HTML, or JavaScript, but it's only
possible to send the control HTTP header with PHP if there
is no body output sent yet, so PHP is out. I recommend:
where is the time to wait before refresh in seconds
and is the _complete_ url to redirect to. Note that
the time and url
You're right, AFAIK.
IMO, it might be more useful (and follow a more expected
format) if var $myVar _did_ initialize the variable and if
you try to use a variable that isn't explicitly defined in
the class throw an error...
But that's not the way it is...
-Toby
- Original Message -
Fro
This isn't really aesthetics as much as it is organization.
You already know that you don't have to declare PHP
variables... if I had a one-line script that simply said:
I would end up with 1 as the output. myVar would be created
as soon as PHP encountered it (it would be empty, however),
and wi
- Original Message -
From: "Neil Zanella" <[EMAIL PROTECTED]>
To: "PHP General Mailing List" <[EMAIL PROTECTED]>
Sent: Tuesday, January 09, 2001 11:55 PM
Subject: [PHP] PHP newbie question
:
: Hello,
:
: I have a question regarding the following 3 one line .php files:
:
:
isset($a) ret
I don't see a query anywhere... you might want to take a look at
http://php.net/manual/function.ibase-fetch-row.php and
http://php.net/manual/function.ibase-query.php and reply back to us if it's
still unclear & not working...
Regards,
Toby Butzon
[ criticism spu
Working with what sort of database?
Toby Butzon
[ criticism spurs improvement ]
- Original Message -
From: "Todd Cary" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, January 09, 2001 10:47 PM
Subject: [PHP] Passing a query result
: I need to pa
t
theoretically it should work.
Toby Butzon
[ criticism spurs improvement ]
- Original Message -
From: "Ignacio Vazquez-Abrams" <[EMAIL PROTECTED]>
To: "Murray Shields" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Tuesday, January 09, 2001 6:41
86 matches
Mail list logo