[PHP] Help with scandir()
Hi, I'm having problems when i try to use the function scandir() in a Novell Netware Volumen or a Windows Shared Folder they both are mapped as a windows network drive, so i suppose i could access them as local drive, but i can't. instead i receive this message: Warning: scandir(R:\) [function.scandir]: failed to open dir: Invalid argument in C:\WebServ\wwwroot\htdocs\index.php on line 3 Warning: scandir() [function.scandir]: (errno 22): Invalid argument in C:\WebServ\wwwroot\htdocs\index.php on line 3 this is the script: i' m logged to novell as an administrator (testing only) if i use scandir() in a local drive it works fine for example: scandir("D:\\") i have appache server 2.0 installed on a WXP SP3 workstation (only for testing) and a Novell Netware Server v5.0 used as a File Server, PHP 5.0.2 did i say something wrong in the previus post that nobody answer it? This is the first time i have access to a mailing list and maybe i don't know how to ask right? Saludos, Dedel. --- Red Telematica de Salud - Cuba CNICM - Infomed
Re: [PHP] How can I detect an exception without using try/catch?
a POSSIBLE work round. see if u can use http://in2.php.net/manual/en/function.error-get-last.php or http://in2.php.net/manual/en/reserved.variables.phperrormsg.php but they are not working as expected with xdebug. use them in the __destruct function to check for an uncaught exception alternatively.. this approach is NOT RECOMMENDED. use it only if u run out of options keep the destructor empty. catch the exception and call a function to perform destruction and then unset the object. at the end of script, check if the object is set, call the function to perform destruction. (php dosent destroy the object if the exception is caught) Kranthi. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Formating Numbers
As an alternative you might consider; $number = sprintf("%01.2f",$number); There was a time many years ago you had to be careful doing math with floats. Test, test and test some more. Warren > -Original Message- > From: kranthi [mailto:kranthi...@gmail.com] > Sent: Saturday, April 25, 2009 8:38 PM > To: Gary > Cc: php-general@lists.php.net > Subject: Re: [PHP] Formating Numbers > > pl post the desired result, the functions > > if u r trying to get $ 34,567.25 > i dont understand y this is not working for u... > http://php.net/manual/en/function.number-format.php#88486 > > -- > PHP General Mailing List (http://www.php.net/) To > unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: RES: [PHP] inexplicable behaviour
if $Count1 is never referenced after this, then certainly this assignment operation is redundent. but assignment is not the ONLY operation of this statement. if u hav not noticed a post increment operator has been used which will affect the value of $Count as well, and this operation is required for the script to work. the script should work even if u replace $Count1 = $Count++; with $Count++; Kranthi. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Formating Numbers
pl post the desired result, the functions if u r trying to get $ 34,567.25 i dont understand y this is not working for u... http://php.net/manual/en/function.number-format.php#88486 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Formating Numbers
I cant seem to get this to work for me. I want the number to be formated to money (us, 2 decimal points). I have gone through manual, tried money_format, number_format, along with setting the variable, but I cant seem to get it to work. I'm sure it is something simple I am missing. Thanks for the help. ';?> "; echo "According to the information you have submitted, your taxes should be $ $correct_tax ";?> $ $savings "; ?> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Change color of anything in double/single quotes
On Sat, Apr 25, 2009 at 13:50, Marc Steinert wrote: > > $string = preg_replace('/"(.*?)"/', '"\\1"', > $string); Close, but I'd also recommend dropping in a 'Us' modifier so that it is `U`ngreedy and `s`pans lines. -- daniel.br...@parasane.net || danbr...@php.net http://www.parasane.net/ || http://www.pilotpig.net/ 50% Off All Shared Hosting Plans at PilotPig: Use Coupon DOW1 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP CLI vs WebServed
Replying this back on the list, unchanged and without any additions from me yet. On Sat, Apr 25, 2009 at 14:09, Simon wrote: >> Perhaps you may want to consider hacking PHP itself. From memory, >> one place you may want to start looking is the >> php_filter_get_storage() function, then trace back from there. If >> memory continues to serve correctly, it should be in the >> `ext/filter/filter.c` file. > > Hacking php is probably the most efficient solution, but until i can > accomplish that, i think i got a good idea... > > what if i opened a socket to php with C function popen(), this enables > to read/write to the stdin/out of the called program (php). I would > execute php to read the code from stdin, and the first few lines would > be created by my 'webserver' and would just set all the correct > superglobals ($_GET, $_POST, $_SERVER, etc) overwritting whatever is > in there with the correct information. Then i would add one last line > with something like: > require('theRealPHPfile.php'); > this one would be executed with the proper superglobals set. > > the result would give something similar to: > $_GET['somevar'] = 'somevalue'; > // [...] more superglobals set here... > require('index.php'); > ?> > (end of example) > This is what my program would do when someone tries to browse to: > website.com/index.php?somevar=somevalue > > I see a loss of performance for creating the header, but other than > this, i think it should be almost as efficient as hacking php... and > being easier... > > What do you guys think? > > Thanks! > -- daniel.br...@parasane.net || danbr...@php.net http://www.parasane.net/ || http://www.pilotpig.net/ 50% Off All Shared Hosting Plans at PilotPig: Use Coupon DOW1 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] I need ideas for things to code
This was a surprisingly good idea that works for me, as I haven't coded in about 3 years and need to get my hand back in. Trying to make use of one idea led to several others. Thanks, tedd! Charles On Sat, Apr 25, 2009 at 4:54 AM, tedd wrote: > At 7:00 PM -0400 4/24/09, Andrew Hucks wrote: > >> I've been coding PHP for about a year, and I'm running out of things to >> code >> that force me to learn new things. If you have any suggestions, I'd >> greatly >> appreciate it. >> > > Andrew: > > Here's an idea. Go through the php manuals and make small examples of > everything you find. > > That way not only do you learn, but you have examples to fall back on when > the need rises. > > Here's a small (believe me) portion of the demo's I've written over the > years: > > http://webbytedd.com/a.php > > These cover different languages, but it will give you the idea. Just make a > inventory of examples and post them with code. Not only will it help you, > but might help others when you answer questions on this list showing the > solution. > > Cheers, > > tedd > -- > --- > http://sperling.com http://ancientstones.com http://earthstones.com > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >
Re: [PHP] Change color of anything in double/single quotes
On Apr 25, 2009, at 13:40, Andrew Hucks wrote: If I have something like $string = '"hello" there'; (the word hello is in double quotes, if you can't see it), how would I output it as something like "hello" there. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Try Echo "& #34;hello & #34;"; Remove the space between the ampersand and the hash mark Bastien -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Change color of anything in double/single quotes
If I have something like $string = '"hello" there'; (the word hello is in double quotes, if you can't see it), how would I output it as something like "hello" there. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Change color of anything in double/single quotes
Andrew Hucks wrote: If I have something like $string = '"hello" there'; (the word hello is in double quotes, if you can't see it), how would I output it as something like "hello" there. Try $string = preg_replace('/"(.*?)"/', '"\\1"', $string); Greetings from Germany Marc Steinert -- Synchronize and share your files over the web for free http://bithub.net/ My Twitter feed http://twitter.com/MarcSteinert -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP CLI vs WebServed
On Sat, Apr 25, 2009 at 10:14, Simon wrote: > > Hopefully, I'm looking for a way that would not require any hacking of > the PHP files that are currently working with other webservers... Perhaps you may want to consider hacking PHP itself. From memory, one place you may want to start looking is the php_filter_get_storage() function, then trace back from there. If memory continues to serve correctly, it should be in the `ext/filter/filter.c` file. -- daniel.br...@parasane.net || danbr...@php.net http://www.parasane.net/ || http://www.pilotpig.net/ 50% Off All Shared Hosting Plans at PilotPig: Use Coupon DOW1 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP CLI vs WebServed
Thanks for the reply Richard! > Never done this, but could you set environment variables, which would > then be picked up by PHP (and stuffed in $_ENV)? This seems like a good idea, if i mix this with the popen() idea, i wouldnt need /dev/shm or any files at all then... but the problem remains that the PHP code will need to be setup to get its querystring (and other web-related data) in the $_ENV global instead of whatever was done before (ie using $_GET, $_COOKIES, etc...) I could create a simple function that would set all these globals correctly, copying the info from $_ENV to the proper global var. This function would need to be placed at the begining of any 'main' php files (ie index.php but not in the files it includes). Hopefully, I'm looking for a way that would not require any hacking of the PHP files that are currently working with other webservers... Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: RES: [PHP] inexplicable behaviour
Oh, the code works ok. Without the $Count1 = $Count++; it does not work. If you are saying it should be $Count+; it does not matter. That's what's weird. I think it would work no matter what I put in it could be $Count1 = $Countmeoutandcrap; and I think it would still work. The similar behaviour was apparent in another code page where I had exactly the same code repeated once and in the second instance the "next" worked with the href but in the first it did not. I checked & checked & checkd and finally I just added a 1 to the first code $Count and it worked. But any instances of $Count1 were commented out. I suspect it may have something to do with sessions or with some stack stuff but I really have no idea. Thanks for your interest. Phil Jônatas Zechim wrote: > Is the $Count++.. > > -Mensagem original- > De: PJ [mailto:af.gour...@videotron.ca] > Enviada em: sexta-feira, 24 de abril de 2009 21:14 > Para: php-general@lists.php.net > Assunto: [PHP] inexplicable behaviour > > Frankly, I don't know what to look for or why something so weird would > happen: > I have pagination set up and the number for pages "next" has a link but > the "next" does not. I have experimented with all sorts of > configurations of the code but the only thing that works (and this is > totally "off the wall") is to do this > $Count = mysql_num_rows($results); > $Count1=$Count++; // without this, the "next" does not do the link--- > but there is no other $Count1 in the code either in the original page or > the include page. > And this phenomenon was apparent in a similar page. > I'd be curious to understand how this could happen. I could post the > whole code, but that would be some 300 lines... > > -- unheralded genius: "A clean desk is the sign of a dull mind. " - Phil Jourdan --- p...@ptahhotep.com http://www.ptahhotep.com http://www.chiccantine.com/andypantry.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP CLI vs WebServed
Hi, >... Never done this, but could you set environment variables, which would then be picked up by PHP (and stuffed in $_ENV)? -- Richard Heyes HTML5 graphing: RGraph (www.rgraph.net) PHP mail: RMail (www.phpguru.org/rmail) PHP datagrid: RGrid (www.phpguru.org/rgrid) PHP Template: RTemplate (www.phpguru.org/rtemplate) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP CLI vs WebServed
Hi there, I've been using PHP for a very long time now, a few years ago developing webapplications with apache and mysql, now and for a few years using mostly the CLI (mostly as a replacement of all other scripting languages available on linux, sh, pearl, etc...). However, I'm building a project that works very much like a webserver (and does much custom stuff) and i would like to execute php files in a similar way as they are executed by a server like apache. I've been executing php from my C/C++ executable simply by writing the HTTP query string in a temp file (/dev/shm/...) and then executing the php file like so: // usage is: phpfile.php system("php /path/to/phpfile.php /dev/shm/this_executions_querystring.txt /dev/shm/this_execution_output_destination.txt"); But the problem is that this phpfile.php has to be made to read the content of the querystring file to get it, etc... also this design will write the output file to /dev/shm, which is then read and sent my the main program. I'm going to use popen in the future... I'd prefer if i could somehow, on the CLI, set the global variables like $_SERVER and others... this would make it so my software could execute any php file that was built for another webserver transparently. Is this possible on the CLI? Is there a simple way to do what I want? (Btw, the server is already handling all the HTTP packaging/parsing, the problem is really just with the execution) Thanks in advance for any suggestions! Simon -- When Earth was the only inhabited planet in the Galaxy, it was a primitive place, militarily speaking. The only weapon they had ever invented worth mentioning was a crude and inefficient nuclear-reaction bomb for which they had not even developed the logical defense. - Asimov -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] I need ideas for things to code
At 7:00 PM -0400 4/24/09, Andrew Hucks wrote: I've been coding PHP for about a year, and I'm running out of things to code that force me to learn new things. If you have any suggestions, I'd greatly appreciate it. Andrew: Here's an idea. Go through the php manuals and make small examples of everything you find. That way not only do you learn, but you have examples to fall back on when the need rises. Here's a small (believe me) portion of the demo's I've written over the years: http://webbytedd.com/a.php These cover different languages, but it will give you the idea. Just make a inventory of examples and post them with code. Not only will it help you, but might help others when you answer questions on this list showing the solution. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php