php-general Digest 9 Nov 2011 15:37:32 -0000 Issue 7558
Topics (messages 315611 through 315614):
Re: pcre little problem
315611 by: QI.VOLMAR QI
Executable flag on text files
315612 by: Ashley Sheridan
315613 by: Curtis Maurand
delete and recreate
315614 by: Kirk Bailey
Administrivia:
To subscribe to the digest, e-mail:
php-general-digest-subscr...@lists.php.net
To unsubscribe from the digest, e-mail:
php-general-digest-unsubscr...@lists.php.net
To post to the list, e-mail:
php-gene...@lists.php.net
----------------------------------------------------------------------
--- Begin Message ---
I've got with preg_replace(). But I guess that filter_var could be used
instead.
Em 08/11/2011 08:46, "tamouse mailing lists" <tamouse.li...@gmail.com>
escreveu:
> On Mon, Nov 7, 2011 at 5:54 AM, Richard Quadling <rquadl...@gmail.com>
> wrote:
> > On 4 November 2011 16:52, QI.VOLMAR QI <qi.vol...@gmail.com> wrote:
> >
> >> i have this part of code that works with DOMDocument:
> >>
> >> public function translateNFeXML(NFE $nfe_factory) {
> >> $inf_adic = $nfe_factory->createElement('infAdic');
> >> if ($this->inf_ad_fisco) {
> >> $inf_adic_fisco =
> >> $nfe_factory->createElement('infAdicFisco', $this->inf_ad_fisco);
> >> $inf_adic->appendChild($inf_adic_fisco);
> >> }
> >>
> >> $string = "a=10&b[]=20&c=30n°&d=40+:50";
> >> die(preg_filter('/[^:][[:punct:]]/', '', $string));
> >> $inf_cpl = $nfe_factory->createElement('infCpl',
> >> $this->inf_complementar);
> >>
> >> QUESTION: Why the preg_filter causes a end of the application, with no
> >> error throwing (even in die don't appears nothing)?
> >
> >
> > preg_filter() returns NULL if there are no matches and the subject is a
> > string.
> >
> > And ...
> >
> > php -r "die(null);"
> >
> > outputs nothing.
>
>
> Here:
>
> >> die(preg_filter('/[^:][[:punct:]]/', '', $string));
>
> Did you really want to do this:
>
> preg_filter('/[^:][[:punct:]]/', '', $string) or die("nothing returned\n");
>
> ???
>
> See http://php.net/manual/en/function.preg-filter.php "Return values"
> as Richard points out preg_filter returns NULL if there are no matched
> in a string.
>
> Now this is interesting:
>
> >> $string = "a=10&b[]=20&c=30n°&d=40+:50";
>
> There is a wide character in that string following 30n. The preg
> functions sometimes don't deal well with wide characters in my
> experience (it's not 100% anyway), you probably need to use the mb_
> functions instead.
>
--- End Message ---
--- Begin Message ---
Sorry for this slightly off-topic post and it not being connected to
the thread that it originally came from, but I remember Tedd was
asking about this.
I'd thought that the executable flag on files didn't do anything for
things like PHP files, etc, but I've just found something that says
otherwise. Seems that in some Linux systems when using the GUI, there
is a switch (in Nautilus at least) that will run a text file if it has
the executable flag rather than open it in a text editor, which seems
to override the default file association behaviour.
--- End Message ---
--- Begin Message ---
On 11/8/2011 6:53 AM, Ashley Sheridan wrote:
Sorry for this slightly off-topic post and it not being connected to
the thread that it originally came from, but I remember Tedd was
asking about this.
I'd thought that the executable flag on files didn't do anything for
things like PHP files, etc, but I've just found something that says
otherwise. Seems that in some Linux systems when using the GUI, there
is a switch (in Nautilus at least) that will run a text file if it has
the executable flag rather than open it in a text editor, which seems
to override the default file association behaviour.
That's true, especially if there is a bang path statement such as
"#!/usr/bin/php" at the top of the file.
If you set the executable flag on a php file with the bang path at the
top, Linux will happily start php and execute the file. I have lots of
little apps and scripts that I've written to work from the command line
that way. On top of that, PHP executes so much better than Perl that I
don't write much in Perl any more. I just wish PEAR had better
documentation.
Cheers,
Curtis
--- End Message ---
--- Begin Message ---
So, I want to create a script to delete an old file and create a new
one which is empty. The script receives a password via query string.
The obvious methods give me back a very useless 500 error. Any
suggestions on how to accomplish what I seek?
--
end
Very Truly yours,
- Kirk Bailey,
Largo Florida
kniht
+-----+
| BOX |
+-----+
think
--- End Message ---