RE: [PHP] php hide menu
Dynamically changing displays can be done with JavaScript. First thing I want you to think of is whether or not your 2nd and 3rd menus require information from the first menu to display or sort. According to what I see they do not. If they do not : We start off wrapping each of the second and 3rd menus in a DIV element and turning them off to display. I am using 2 options pick which one is best for you. We can display them individually by "ID" or by the group of "class". Now we give an ID attribute to the first menu. echo "Choose Market\n"; Put your 2nd menu in here Put your 3nd menu in here In this example I will utilize JQuery.js IF you do not have it you can download it from www.jquery.com . Please do not use both function if you use a class use the class if you use and ID base use the ID $(document).ready(function(){ // this will display them by ID $('#market').change( Function() { Val marketvalue = $(This).val(); // I am doing this because what if they change the menu back to the default value of '' If(marketvalue >= 1) { $('#Menu2').show(); $('#Menu3').show(); }else{ $('#Menu2').hide(); $('#Menu3').hide(); } } ); // this will display them by the class $('#market').change( Function() { Val marketvalue = $(This).val(); // I am doing this because what if they change the menu back to the default value of '' If(marketvalue >= 1) { $('.other_menus').show(); }else{ $('.other_menus').hide(); } } ); }); This will display the menu items as soon as they pick from the first menu NOT requiring a submit. If you do require the value from the first menu to be passed to the select statements for the other menus let me know I will explain how that is done, it is a little more complex. Richard L. Buskirk -Original Message- From: Chris Stinemetz [mailto:chrisstinem...@gmail.com] Sent: Tuesday, June 07, 2011 12:41 AM To: php-general@lists.php.net Subject: [PHP] php hide menu I have three drop down menus in my form. How do I make it so the second and third menus are only visible once the prior menu was selected? Below is the first two drop down menus. Thanks in advance. // Generating first menu using array. $markets = array('MCI' => 'Kansas City', 'STL' => 'ST. Louis', 'ICT' => 'Wichita', 'OMA' => 'Omaha', 'LIN' => 'Lincoln'); echo "Choose Market\n"; foreach ($markets as $key => $market) { echo "$market\n"; } echo ""; // This will evaluate to TRUE so the text will be printed. if (isset($markets)) { echo "This var is set so I will print."; } // Then, later, validating the menu if (! array_key_exists($_POST['Market'], $choices)) { echo "You must select a market."; } $query="SELECT cell_sect FROM sector_list order by cell_sect"; $result = mysql_query ($query); echo "Choose Cell Sector"; // printing the list box select command while($cellSect=mysql_fetch_array($result)){//Array or records stored in $cellSect echo "$cellSect[cell_sect]"; /* Option values are added by looping through the array */ } echo "";// Closing of list box // This will evaluate to TRUE so the text will be printed. if (isset($cellSect)) { echo "This var is set so I will print."; } -- 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: [PHP] Can't use class "'DOMDocument"
Did you install the php-xml ? Richard L. Buskirk -Original Message- From: Adam Tong [mailto:adam.to...@gmail.com] Sent: Monday, June 06, 2011 9:49 PM To: php-general@lists.php.net Subject: [PHP] Can't use class "'DOMDocument" Hi, When I try using DOMDocument I get the following error: Fatal error: Class 'DOMDocument' not found in ... I guess something has to be fixed in my php.ini? Here is my php version: # php -version PHP 5.3.6 (cli) (built: Mar 17 2011 20:58:15) Copyright (c) 1997-2011 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2011 Zend Technologies I also noticed when I click reply in gmail it does not reply to the list. Sorry for that inconvenience for poeple who tried to help me while the previous issue was already resolved. Thank you -- 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: [PHP] PHP download page blocking other HTTP requests
On 06/06/11 21:07, Richard Quadling wrote: On 6 June 2011 13:55, Pete Ford wrote: Is there something on the Apache/PHP end that might be causing this blocking? (Apache 2.2.10, PHP 5.2.14) The browser and / or OS may be obeying the settings about the number of simultaneous connections per host. http://support.microsoft.com/kb/183110 / http://www.ietf.org/rfc/rfc2616.txt 8.1.4 Practical Considerations ... " Clients that use persistent connections SHOULD limit the number of simultaneous connections that they maintain to a given server. A single-user client SHOULD NOT maintain more than 2 connections with any server or proxy. A proxy SHOULD use up to 2*N connections to another server or proxy, where N is the number of simultaneously active users. These guidelines are intended to improve HTTP response times and avoid congestion." Also, (from googling) http://forums.serverbeach.com/showthread.php?6192-Max-Concurrent-Connections-Per-Host, mod_throttle and/or mod_bandwidth may be capable of restricting the number and/or speed of connections. Thanks Richard, There's no mod_throttle or mod_bandwidth, but I SHOULD have remembered RFC2616. I'll look into working with that, although I'm having trouble reproducing the problem since my dev machine sits on the same network as the server and the files come down too quickly! Maybe I can use a redirect or something to force a new connection... -- Peter Ford, Developer phone: 01580 89 fax: 01580 893399 Justcroft International Ltd. www.justcroft.com Justcroft House, High Street, Staplehurst, Kent TN12 0AH United Kingdom Registered in England and Wales: 2297906 Registered office: Stag Gates House, 63/64 The Avenue, Southampton SO17 1XS -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Going crazy with include & require not working
On 7 June 2011 04:05, tedd wrote: > At 5:50 PM -0700 6/6/11, Brian Dunning wrote: >> >> Here's my code: >> >> error_reporting(E_ALL); Not all errors are reported using E_ALL. Try error_reporting(-1); Also, check the include files don't then set error_reporting(0) or something like that. -- Richard Quadling Twitter : EE : Zend : PHPDoc @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP download page blocking other HTTP requests
On 7 June 2011 09:24, Pete Ford wrote: > On 06/06/11 21:07, Richard Quadling wrote: >> >> On 6 June 2011 13:55, Pete Ford wrote: >>> >>> Is there something on the Apache/PHP end that might be causing this >>> blocking? (Apache 2.2.10, PHP 5.2.14) >> >> The browser and / or OS may be obeying the settings about the number >> of simultaneous connections per host. >> http://support.microsoft.com/kb/183110 / >> http://www.ietf.org/rfc/rfc2616.txt 8.1.4 Practical Considerations ... >> >> " Clients that use persistent connections SHOULD limit the number of >> simultaneous connections that they maintain to a given server. A >> single-user client SHOULD NOT maintain more than 2 connections with >> any server or proxy. A proxy SHOULD use up to 2*N connections to >> another server or proxy, where N is the number of simultaneously >> active users. These guidelines are intended to improve HTTP response >> times and avoid congestion." >> >> Also, (from googling) >> >> http://forums.serverbeach.com/showthread.php?6192-Max-Concurrent-Connections-Per-Host, >> mod_throttle and/or mod_bandwidth may be capable of restricting the >> number and/or speed of connections. >> > > Thanks Richard, > > There's no mod_throttle or mod_bandwidth, but I SHOULD have remembered > RFC2616. I'll look into working with that, although I'm having trouble > reproducing the problem since my dev machine sits on the same network as the > server and the files come down too quickly! > Maybe I can use a redirect or something to force a new connection... > One option may be to use a sub-domain for the downloads, that way, you could allow the main site to run as fast as needed and have downloads on a different setup and not subject to the same limit. -- Richard Quadling Twitter : EE : Zend : PHPDoc @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] What do you get for ...
Hi. What do you get for ... php -r "var_dump(realpath(null));" I'm wondering if the result should be a boolean false. But I'm getting very different results for different versions of PHP for Windows. For PHP5+ (upto lastest 5.3.7-dev), the output is always the same as getcwd() For PHP4, some very interesting differences ... V4.0.0 : string(5) "Z:\\/" V4.0.1 : string(5) "z:\\/" V4.0.1pl1 : string(5) "z:\\/" V4.0.2 : bool(false) V4.0.3 : bool(false) V4.0.4 : string(3) "z:\" V4.0.4pl1 : string(3) "z:\" V4.0.5 : string(3) "z:\" V4.0.6 : string(3) "z:\" V4.1.0 : string(3) "z:\" V4.1.1 : string(3) "z:\" V4.1.2 : string(3) "z:\" V4.2.0 : string(98) "D:\Personal Files\Downloads\Software\Programming\PHP\Official Releases\PHP4.x.x\PHP4.2.x\php-4.2.0" V4.2.1 : string(3) "z:\" V4.2.2 : string(3) "z:\" V4.2.3 : string(3) "z:\" V4.2.3RC1 : string(3) "z:\" V4.2.3RC2 : string(3) "z:\" V4.3.0 : string(3) "z:\" V4.3.0pre2 : string(102) "D:\Personal Files\Downloads\Software\Programming\PHP\Official Releases\PHP4.x.x\PHP4.3.x\php-4.3.0pre2" V4.3.0RC1 : string(101) "D:\Personal Files\Downloads\Software\Programming\PHP\Official Releases\PHP4.x.x\PHP4.3.x\php-4.3.0RC1" V4.3.0RC2 : string(101) "D:\Personal Files\Downloads\Software\Programming\PHP\Official Releases\PHP4.x.x\PHP4.3.x\php-4.3.0RC2" V4.3.0RC3 : string(101) "D:\Personal Files\Downloads\Software\Programming\PHP\Official Releases\PHP4.x.x\PHP4.3.x\php-4.3.0RC3" V4.3.0RC4 : string(3) "z:\" V4.3.1 : string(3) "z:\" V4.3.10 : string(3) "z:\" V4.3.11 : string(3) "z:\" V4.3.2 : string(3) "z:\" V4.3.2RC1 : string(3) "z:\" V4.3.2RC2 : string(3) "z:\" V4.3.2RC3 : string(3) "z:\" V4.3.3 : string(3) "z:\" V4.3.3RC1 : string(3) "z:\" V4.3.3RC2 : string(3) "z:\" V4.3.3RC3 : string(3) "z:\" V4.3.3RC4 : string(3) "z:\" V4.3.4 : string(3) "z:\" V4.3.4RC1 : string(3) "z:\" V4.3.4RC2 : string(3) "z:\" V4.3.4RC3 : string(3) "z:\" V4.3.5 : string(3) "z:\" V4.3.5RC1 : string(3) "z:\" V4.3.5RC2 : string(3) "z:\" V4.3.5RC3 : string(3) "z:\" V4.3.5RC4 : string(3) "z:\" V4.3.6 : string(3) "z:\" V4.3.6RC1 : string(3) "z:\" V4.3.6RC2 : string(3) "z:\" V4.3.6RC3 : string(3) "z:\" V4.3.7 : string(3) "z:\" V4.3.7RC1 : string(3) "z:\" V4.3.8 : string(3) "z:\" V4.3.9 : string(3) "z:\" V4.3.9RC1 : string(3) "z:\" V4.4.0 : string(3) "z:\" V4.4.1 : string(3) "z:\" V4.4.2 : string(3) "z:\" V4.4.3 : string(3) "z:\" V4.4.4 : string(3) "z:\" V4.4.5 : string(3) "z:\" V4.4.6 : string(3) "z:\" V4.4.7 : string(3) "z:\" V4.4.8 : string(3) "z:\" V4.4.9 : string(3) "z:\" Z:\ is essentially the equivalent of __DIR__ in this example. What output do you get on non Windows setups? php -r "var_dump(realpath(null));" If the current releases on other OS's all have output equivalent to getcwd(), then I'll change the documentation to at least mention that a null or empty path equates to the current working directory for V5+. Richard. -- Richard Quadling Twitter : EE : Zend : PHPDoc @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] What do you get for ...
>-Original Message- >From: Richard Quadling [mailto:rquadl...@gmail.com] >Sent: 07 June 2011 11:35 >To: PHP General list >Subject: [PHP] What do you get for ... > >Hi. > >What do you get for ... > >php -r "var_dump(realpath(null));" > >I'm wondering if the result should be a boolean false. > >But I'm getting very different results for different versions of PHP >for Windows. > >For PHP5+ (upto lastest 5.3.7-dev), the output is always the same as getcwd() > [snip] I get the following in Win7 Pro x64 SP1 running PHP 5.3.6: --- BEGIN OUTPUT --- Microsoft Windows [Version 6.1.7601] Copyright (c) 2009 Microsoft Corporation. All rights reserved. D:\>php -r "var_dump(realpath(null));" string(3) "D:\" D:\> -- END OUTPUT --- HTH J -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] What do you get for ...
Microsoft Windows Version 5.1.2600 E:\>php -r "var_dump(realpath(null));" string(41) "E:\" E:\> Richard L. Buskirk -Original Message- From: Richard Quadling [mailto:rquadl...@gmail.com] Sent: Tuesday, June 07, 2011 6:35 AM To: PHP General list Subject: [PHP] What do you get for ... Hi. What do you get for ... php -r "var_dump(realpath(null));" I'm wondering if the result should be a boolean false. But I'm getting very different results for different versions of PHP for Windows. For PHP5+ (upto lastest 5.3.7-dev), the output is always the same as getcwd() For PHP4, some very interesting differences ... V4.0.0 : string(5) "Z:\\/" V4.0.1 : string(5) "z:\\/" V4.0.1pl1 : string(5) "z:\\/" V4.0.2 : bool(false) V4.0.3 : bool(false) V4.0.4 : string(3) "z:\" V4.0.4pl1 : string(3) "z:\" V4.0.5 : string(3) "z:\" V4.0.6 : string(3) "z:\" V4.1.0 : string(3) "z:\" V4.1.1 : string(3) "z:\" V4.1.2 : string(3) "z:\" V4.2.0 : string(98) "D:\Personal Files\Downloads\Software\Programming\PHP\Official Releases\PHP4.x.x\PHP4.2.x\php-4.2.0" V4.2.1 : string(3) "z:\" V4.2.2 : string(3) "z:\" V4.2.3 : string(3) "z:\" V4.2.3RC1 : string(3) "z:\" V4.2.3RC2 : string(3) "z:\" V4.3.0 : string(3) "z:\" V4.3.0pre2 : string(102) "D:\Personal Files\Downloads\Software\Programming\PHP\Official Releases\PHP4.x.x\PHP4.3.x\php-4.3.0pre2" V4.3.0RC1 : string(101) "D:\Personal Files\Downloads\Software\Programming\PHP\Official Releases\PHP4.x.x\PHP4.3.x\php-4.3.0RC1" V4.3.0RC2 : string(101) "D:\Personal Files\Downloads\Software\Programming\PHP\Official Releases\PHP4.x.x\PHP4.3.x\php-4.3.0RC2" V4.3.0RC3 : string(101) "D:\Personal Files\Downloads\Software\Programming\PHP\Official Releases\PHP4.x.x\PHP4.3.x\php-4.3.0RC3" V4.3.0RC4 : string(3) "z:\" V4.3.1 : string(3) "z:\" V4.3.10 : string(3) "z:\" V4.3.11 : string(3) "z:\" V4.3.2 : string(3) "z:\" V4.3.2RC1 : string(3) "z:\" V4.3.2RC2 : string(3) "z:\" V4.3.2RC3 : string(3) "z:\" V4.3.3 : string(3) "z:\" V4.3.3RC1 : string(3) "z:\" V4.3.3RC2 : string(3) "z:\" V4.3.3RC3 : string(3) "z:\" V4.3.3RC4 : string(3) "z:\" V4.3.4 : string(3) "z:\" V4.3.4RC1 : string(3) "z:\" V4.3.4RC2 : string(3) "z:\" V4.3.4RC3 : string(3) "z:\" V4.3.5 : string(3) "z:\" V4.3.5RC1 : string(3) "z:\" V4.3.5RC2 : string(3) "z:\" V4.3.5RC3 : string(3) "z:\" V4.3.5RC4 : string(3) "z:\" V4.3.6 : string(3) "z:\" V4.3.6RC1 : string(3) "z:\" V4.3.6RC2 : string(3) "z:\" V4.3.6RC3 : string(3) "z:\" V4.3.7 : string(3) "z:\" V4.3.7RC1 : string(3) "z:\" V4.3.8 : string(3) "z:\" V4.3.9 : string(3) "z:\" V4.3.9RC1 : string(3) "z:\" V4.4.0 : string(3) "z:\" V4.4.1 : string(3) "z:\" V4.4.2 : string(3) "z:\" V4.4.3 : string(3) "z:\" V4.4.4 : string(3) "z:\" V4.4.5 : string(3) "z:\" V4.4.6 : string(3) "z:\" V4.4.7 : string(3) "z:\" V4.4.8 : string(3) "z:\" V4.4.9 : string(3) "z:\" Z:\ is essentially the equivalent of __DIR__ in this example. What output do you get on non Windows setups? php -r "var_dump(realpath(null));" If the current releases on other OS's all have output equivalent to getcwd(), then I'll change the documentation to at least mention that a null or empty path equates to the current working directory for V5+. Richard. -- Richard Quadling Twitter : EE : Zend : PHPDoc @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea -- 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: [PHP] php hide menu
> If you do require the value from the first menu to be passed to the select > statements for the other menus let me know I will explain how that is done, > it is a little more complex. > I would like to pass the value from the prior menu to the next. Would you please show me how to handle this? Thank you, Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What do you get for ...
> -Original Message- > What output do you get on non Windows setups? Hmmm. I really should have asked what the non windows users get. Oh. Look. I did. ;-) -- Richard Quadling Twitter : EE : Zend : PHPDoc @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What do you get for ...
On Tue, Jun 7, 2011 at 12:10 PM, Richard Quadling wrote: > > -Original Message- > > What output do you get on non Windows setups? > OSX 10.6.7 PHP 5.3.4 OSX Server 10.6 PHP 5.3.0 Linux 2.6.35.4-rscloud (Rackspace cloud) PHP 5.3.6 Linux 2.6.18 (CentOS) PHP 5.2.10 Linux 2.6.18 (CentOS) PHP 5.2.13 All return __DIR__. -Stuart -- Stuart Dallas 3ft9 Ltd http://3ft9.com/
RE: [PHP] php hide menu
[snip] I would like to pass the value from the prior menu to the next. Would you please show me how to handle this? [/snip] As several have mentioned, this is a job for AJAX and JavaScript. Here is a good tutorial: http://www.yourinspirationweb.com/en/how-to-create-chained-select-with-p hp-and-jquery/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What do you get for ...
On 7 June 2011 12:25, Stuart Dallas wrote: > On Tue, Jun 7, 2011 at 12:10 PM, Richard Quadling > wrote: >> >> > -Original Message- >> > What output do you get on non Windows setups? > > OSX 10.6.7 > PHP 5.3.4 > OSX Server 10.6 > PHP 5.3.0 > Linux 2.6.35.4-rscloud (Rackspace cloud) > PHP 5.3.6 > Linux 2.6.18 (CentOS) > PHP 5.2.10 > Linux 2.6.18 (CentOS) > PHP 5.2.13 > All return __DIR__. > -Stuart > -- > Stuart Dallas > 3ft9 Ltd > http://3ft9.com/ Thank you. I'll update the documentation appropriately. -- Richard Quadling Twitter : EE : Zend : PHPDoc @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: What do you get for ...
On Tuesday, June 7, 2011, Richard Quadling wrote: > What do you get for ... > php -r "var_dump(realpath(null));" PHP 5.3.5-1ubuntu7.2 on Ubuntu 11.04 kernel 2.6.18 returns the same value as __DIR__ However, PHP 5.1.6 on CentOS 5.6 kernel 2.6.18 returns bool(false). Doing php -r "var_dump(__DIR__);" on this machine shows that __DIR__ is undefined. Executing both commands in an intranet-visible, php script shows the same thing. HTH, -- Geoff -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: What do you get for ...
On 7 June 2011 13:04, Geoff Lane wrote: > On Tuesday, June 7, 2011, Richard Quadling wrote: > >> What do you get for ... > >> php -r "var_dump(realpath(null));" > > PHP 5.3.5-1ubuntu7.2 on Ubuntu 11.04 kernel 2.6.18 returns the same > value as __DIR__ > > However, PHP 5.1.6 on CentOS 5.6 kernel 2.6.18 returns bool(false). __DIR__ was introduced in PHP5.3.0. When I mentioned it, I meant the value would be the directory of the script path. dirname(__FILE__) or __DIR__. Same difference. But the surprising issue is that your 5.1.6 returns bool(false). So far, that's the only report I've got that shows inconsistent behaviour for PHP5+ -- Richard Quadling Twitter : EE : Zend : PHPDoc @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What do you get for ...
On Tuesday 07 June 2011 13:35:06 Richard Quadling wrote: > Hi. > > What do you get for ... > > php -r "var_dump(realpath(null));" > 1. PHP 5.3.6 @ Gentoo Linux(x86_64) tmp $ php -r "print getcwd();" /var/tmp tmp $ php -r "var_dump(realpath(null));" string(8) "/var/tmp" 2. PHP 5.2.14 @ Linux(ARM) tmp $ php -r "print getcwd();" /var/tmp tmp $ php -r "var_dump(realpath(null));" string(8) "/var/tmp" -- Vitalii -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What do you get for ...
On Tue, 2011-06-07 at 16:09 +0300, Vitalii Demianets wrote: > On Tuesday 07 June 2011 13:35:06 Richard Quadling wrote: > > Hi. > > > > What do you get for ... > > > > php -r "var_dump(realpath(null));" > > > > 1. > PHP 5.3.6 @ Gentoo Linux(x86_64) > > tmp $ php -r "print getcwd();" > /var/tmp > > tmp $ php -r "var_dump(realpath(null));" > string(8) "/var/tmp" > > 2. > PHP 5.2.14 @ Linux(ARM) > > tmp $ php -r "print getcwd();" > /var/tmp > > tmp $ php -r "var_dump(realpath(null));" > string(8) "/var/tmp" > > -- > Vitalii > sstaples@webdev01:~$ php -v PHP 5.2.10-2ubuntu6.4 with Suhosin-Patch 0.9.7 (cli) (built: Jan 6 2010 22:41:56) Copyright (c) 1997-2009 The PHP Group Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies sstaples@webdev01:~$ sstaples@webdev01:~$ pwd /home/sstaples sstaples@webdev01:~$ php -r "var_dump(realpath(null));" string(14) "/home/sstaples" sstaples@webdev01:~$ I am running Ubuntu 9.10 Steve. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What do you get for ...
On 07 Jun 2011 at 11:35, Richard Quadling wrote: > What do you get for ... > > php -r "var_dump(realpath(null));" OS X: string(10) "/Users/tim" -- Cheers -- Tim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: What do you get for ...
On Tuesday, June 7, 2011, Richard Quadling wrote: > But the surprising issue is that your 5.1.6 returns bool(false). So > far, that's the only report I've got that shows inconsistent > behaviour for PHP5+ I too was surprised, which is why I took the time to report. AFAICT, I've got the standard LAMP stack for CentOS 5.6 from the time I developed the first application on it. The output from print_r($_SERVER) contains the expected script-related paths and I don't get issues running PHP scripts on this server either via Apache or via cron (as shell scripts). If specific output from this server would help, I may be able to give this to you off-list. HTH, -- Geoff -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php hide menu
At 11:40 PM -0500 6/6/11, Chris Stinemetz wrote: I have three drop down menus in my form. How do I make it so the second and third menus are only visible once the prior menu was selected? Chris: You mean something like this? http://php1.net/b/zipcode-states/ The explanation (and js) is there. The back-end php is simply looking through database to populate the "second selection control" based upon selection of the first; and then populates the "third selection control" based upon the selection of the second. It's not that complicated -- just take baby steps. Cheers, tedd -- --- http://sperling.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php hide menu
At 12:12 PM -0500 6/7/11, Chris Stinemetz wrote: > Chris: You mean something like this? http://php1.net/b/zipcode-states/ The explanation (and js) is there. Yes, do you have a tutorial to go with the demo? Thank you, The demo is a tutorial. The javascript code is there -- just download it. The code to populate the selection boxes is very similar to this: http://www.php1.net/b/form-checkbox1/ From those two, you should be able to make your way. After all, that's what I did. Cheers, tedd PS: Also, please reply to the list and not me. -- --- http://sperling.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Fuzzy Array Search
What would be the easiest way to do a fuzzy array search? Can I do this without having to step through the array? Thanks! Floyd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Fuzzy Array Search
What do you mean by "fuzzy search"? Like an approximate search, and instead of you stepping through the array, you guesstimate where to start, or search for approximate string value in an array of strings? -- The trouble with programmers is that you can never tell what a programmer is doing until it’s too late. ~Seymour Cray On Tue, Jun 7, 2011 at 1:45 PM, Floyd Resler wrote: > What would be the easiest way to do a fuzzy array search? Can I do this > without having to step through the array? > > Thanks! > Floyd > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >
[PHP] Re: Fuzzy Array Search
On 06/07/2011 12:45 PM, Floyd Resler wrote: > What would be the easiest way to do a fuzzy array search? Can I do this > without having to step through the array? > > Thanks! > Floyd > I use preg_grep() -- Thanks! -Shawn http://www.spidean.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Fuzzy Array Search
If you don't need the location, you can implode the array and use preg match, quickly testing it, that gives you about 4.5 times performance increase, but it wont give you the location, only if a certain value exists within the array... You can kind of do some really clever math to get your search parameters from there, which would be feasible on really large data sets, but if you want location, you will have to iterate at some point... (sorry i keep on hitting reply instead of reply to all) -- The trouble with programmers is that you can never tell what a programmer is doing until it’s too late. ~Seymour Cray On Tue, Jun 7, 2011 at 2:57 PM, Shawn McKenzie wrote: > On 06/07/2011 12:45 PM, Floyd Resler wrote: > > What would be the easiest way to do a fuzzy array search? Can I do this > without having to step through the array? > > > > Thanks! > > Floyd > > > > I use preg_grep() > > -- > Thanks! > -Shawn > http://www.spidean.com > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >
[PHP] advice on how to build this array from an array.
hi all, please forgive me if i do not make sense, ill try my best to explain. i have this array or arrays. Array ( [name] => super duplex stainless steels [id] => 30 [page_cat_id] => 10 [main_nav] => true [cat_name] => material range ) Array ( [name] => standard stainless steels [id] => 31 [page_cat_id] => 10 [main_nav] => true [cat_name] => material range ) Array ( [name] => non ferrous [id] => 32 [page_cat_id] => 10 [main_nav] => true [cat_name] => material range ) Array ( [name] => carbon based steels [id] => 33 [page_cat_id] => 10 [main_nav] => true [cat_name] => material range ) is it possible to build an array and use the [cat_name] as the key and assign all the pages to that cat_name? what im trying to achieve is a category of pages but i want the cat_name as the key to all the pages associated to it hope i make sense kind regards Adam -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Fuzzy Array Search
On Jun 7, 2011, at 4:42 PM, Alex Nikitin wrote: > If you don't need the location, you can implode the array and use preg > match, quickly testing it, that gives you about 4.5 times performance > increase, but it wont give you the location, only if a certain value exists > within the array... You can kind of do some really clever math to get your > search parameters from there, which would be feasible on really large data > sets, but if you want location, you will have to iterate at some point... > > (sorry i keep on hitting reply instead of reply to all) > > -- > The trouble with programmers is that you can never tell what a programmer is > doing until it’s too late. ~Seymour Cray > > > > On Tue, Jun 7, 2011 at 2:57 PM, Shawn McKenzie wrote: > >> On 06/07/2011 12:45 PM, Floyd Resler wrote: >>> What would be the easiest way to do a fuzzy array search? Can I do this >> without having to step through the array? >>> >>> Thanks! >>> Floyd >>> >> >> I use preg_grep() >> >> -- >> Thanks! >> -Shawn >> http://www.spidean.com >> I actually do need the location since I need to get the resulting match. I went ahead and tried to iterate the array and it was MUCH faster than I expected it to be! Of course, considering the machine I'm running this on is a monster (2.66 GHz 8 cores, 24GB of RAM) it shouldn't have surprised me! Thanks! Floyd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Going crazy with include & require not working
Thanks, this helped me solve it. FPDI extends a class in FPDF, so I simply had to reverse the order in which I call them and all is hunky dory. On Jun 6, 2011, at 5:54 PM, Michael Shadle wrote: > > ini_set('display_errors', 1); > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Fuzzy Array Search
On 06/07/2011 03:57 PM, Floyd Resler wrote: > > On Jun 7, 2011, at 4:42 PM, Alex Nikitin wrote: > >> If you don't need the location, you can implode the array and use preg >> match, quickly testing it, that gives you about 4.5 times performance >> increase, but it wont give you the location, only if a certain value exists >> within the array... You can kind of do some really clever math to get your >> search parameters from there, which would be feasible on really large data >> sets, but if you want location, you will have to iterate at some point... >> >> (sorry i keep on hitting reply instead of reply to all) >> >> -- >> The trouble with programmers is that you can never tell what a programmer is >> doing until it’s too late. ~Seymour Cray >> >> >> >> On Tue, Jun 7, 2011 at 2:57 PM, Shawn McKenzie wrote: >> >>> On 06/07/2011 12:45 PM, Floyd Resler wrote: What would be the easiest way to do a fuzzy array search? Can I do this >>> without having to step through the array? Thanks! Floyd >>> >>> I use preg_grep() >>> >>> -- >>> Thanks! >>> -Shawn >>> http://www.spidean.com >>> > > I actually do need the location since I need to get the resulting match. I > went ahead and tried to iterate the array and it was MUCH faster than I > expected it to be! Of course, considering the machine I'm running this on is > a monster (2.66 GHz 8 cores, 24GB of RAM) it shouldn't have surprised me! > > Thanks! > Floyd > If you are using a straight equality comparison then the loop would be faster (but then array search would probably be better), however if you need to use a preg_match() in the loop ("fuzzy search"), then preg_grep() will be much faster than the loop. LOOP WITH PREG_MATCH: 10 0.435957 seconds PREG_GREP: 10 0.085604 seconds LOOP WITH IF ==: 10 0.044594 seconds PREG_GREP: 10 0.091519 seconds -- Thanks! -Shawn http://www.spidean.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] advice on how to build this array from an array.
> From: a...@blueyonder.co.uk > Date: Tue, 7 Jun 2011 21:50:27 +0100 > To: php-general@lists.php.net > Subject: [PHP] advice on how to build this array from an array. > > hi all, > > please forgive me if i do not make sense, ill try my best to explain. > > > i have this array or arrays. > > Array ( [name] => super duplex stainless steels [id] => 30 [page_cat_id] => > 10 [main_nav] => true [cat_name] => material range ) > Array ( [name] => standard stainless steels [id] => 31 [page_cat_id] => 10 > [main_nav] => true [cat_name] => material range ) > Array ( [name] => non ferrous [id] => 32 [page_cat_id] => 10 [main_nav] => > true [cat_name] => material range ) > Array ( [name] => carbon based steels [id] => 33 [page_cat_id] => 10 > [main_nav] => true [cat_name] => material range ) > > is it possible to build an array and use the [cat_name] as the key and assign > all the pages to that cat_name? > > what im trying to achieve is a category of pages but i want the cat_name as > the key to all the pages associated to it > > hope i make sense > > kind regards > > Adam Suppose that $arrays is your array of arrays. Then is $res = array(); foreach($arrays as $item){ $res[$item['cat_name']][] = $item; } what you are looking for? Best regards, Jasper Mulder -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Fuzzy Array Search
It runs fast on my 2.33 core 2, and about as fast on this small data set, on the dual 6 core with 96GB ram, or the 8 core 9GB box, it depends on the size of your data set, memory speed and latency, and miniscule amount of processing power (once again assuming small data set). That said, you could probably do some clever stuff to minimize the range you are looking for. For example, you could use the average record size with imploding the array and searching, capturing the offset, you could potentially cut out a lot of records that you are, within a certain probability sure that the result is not in, making your search execute faster by not even looking in the majority of data in most cases, this would be interesting to test out actually. You could sort the array to further narrow down the search by some criteria, what have you. This would all apply if you are searching very large data sets, i am talking about multiple billion data points. And all that said, arrays are not really a good data-structure for searching anyways, that's why they are rarely used in file systems or as memory data structures ;) Shawn, == is not good for string comparison, its a bad habit that one should get out of, use ===, its much safer . Also try the same algorithm on 10 arrays of some number of values 10-1000 perhaps, that would give you better performance statistics :) -- Alex -- The trouble with programmers is that you can never tell what a programmer is doing until it’s too late. ~Seymour Cray On Tue, Jun 7, 2011 at 5:25 PM, Shawn McKenzie wrote: > On 06/07/2011 03:57 PM, Floyd Resler wrote: > > > > On Jun 7, 2011, at 4:42 PM, Alex Nikitin wrote: > > > >> If you don't need the location, you can implode the array and use preg > >> match, quickly testing it, that gives you about 4.5 times performance > >> increase, but it wont give you the location, only if a certain value > exists > >> within the array... You can kind of do some really clever math to get > your > >> search parameters from there, which would be feasible on really large > data > >> sets, but if you want location, you will have to iterate at some > point... > >> > >> (sorry i keep on hitting reply instead of reply to all) > >> > >> -- > >> The trouble with programmers is that you can never tell what a > programmer is > >> doing until it’s too late. ~Seymour Cray > >> > >> > >> > >> On Tue, Jun 7, 2011 at 2:57 PM, Shawn McKenzie > wrote: > >> > >>> On 06/07/2011 12:45 PM, Floyd Resler wrote: > What would be the easiest way to do a fuzzy array search? Can I do > this > >>> without having to step through the array? > > Thanks! > Floyd > > >>> > >>> I use preg_grep() > >>> > >>> -- > >>> Thanks! > >>> -Shawn > >>> http://www.spidean.com > >>> > > > > I actually do need the location since I need to get the resulting match. > I went ahead and tried to iterate the array and it was MUCH faster than I > expected it to be! Of course, considering the machine I'm running this on > is a monster (2.66 GHz 8 cores, 24GB of RAM) it shouldn't have surprised me! > > > > Thanks! > > Floyd > > > > If you are using a straight equality comparison then the loop would be > faster (but then array search would probably be better), however if you > need to use a preg_match() in the loop ("fuzzy search"), then > preg_grep() will be much faster than the loop. > > LOOP WITH PREG_MATCH: 10 > 0.435957 seconds > PREG_GREP: 10 > 0.085604 seconds > > LOOP WITH IF ==: 10 > 0.044594 seconds > PREG_GREP: 10 > 0.091519 seconds > > -- > Thanks! > -Shawn > http://www.spidean.com >
Re: [PHP] Re: Fuzzy Array Search
On 06/07/2011 04:28 PM, Floyd Resler wrote: > > Shawn, > I'm terrible with regular expressions. Could you give me an example? > > Thanks! > Floyd > > Depends. Could be as simple as this to return an array of all occurrences of $needle in any of the $haystack_array values: $haystack_array = array('something is here', 'nothing matches here', 'there will be a somethingsomething match here'); $needle = 'something'; $matches_array = preg_grep("/$needle/", $haystack_array); Depends on where you are getting the search criteria and how you want it to match in the array. BTW... If this is originally in a database then you can do it there with the LIKE operator and % wildcard. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] advice on how to build this array from an array.
hi, thanks for your reply. i have figured out, well kind of, and got the data i need but the problem is its nested within to many arrays! Array ( [threads & form types] => Array ( [0] => Array ( [name] => imperial thread form [id] => 28 [page_cat_id] => 9 [main_nav] => true ) [1] => Array ( [name] => metric iso threads [id] => 29 [page_cat_id] => 9 [main_nav] => true ) ) [material range] => Array ( [0] => Array ( [name] => super duplex stainless steels [id] => 30 [page_cat_id] => 10 [main_nav] => true ) [1] => Array ( [name] => standard stainless steels [id] => 31 [page_cat_id] => 10 [main_nav] => true ) [2] => Array ( [name] => non ferrous [id] => 32 [page_cat_id] => 10 [main_nav] => true ) [3] => Array ( [name] => carbon based steels [id] => 33 [page_cat_id] => 10 [main_nav] => true ) ) ) how can i get this just do its a $k => $v pair, the key as it is [threads & form types] && [material range], and the value, the single array [Array ( [name] => imperial thread form [id] => 28 [page_cat_id] => 9 [main_nav] => true ) [1] => Array ( [name] => metric iso threads [id] => 29 [page_cat_id] => 9 [main_nav] => true )] ? hope this makes sense Adam On 7 Jun 2011, at 22:25, Jasper Mulder wrote: > > >> From: a...@blueyonder.co.uk >> Date: Tue, 7 Jun 2011 21:50:27 +0100 >> To: php-general@lists.php.net >> Subject: [PHP] advice on how to build this array from an array. >> >> hi all, >> >> please forgive me if i do not make sense, ill try my best to explain. >> >> >> i have this array or arrays. >> >> Array ( [name] => super duplex stainless steels [id] => 30 [page_cat_id] => >> 10 [main_nav] => true [cat_name] => material range ) >> Array ( [name] => standard stainless steels [id] => 31 [page_cat_id] => 10 >> [main_nav] => true [cat_name] => material range ) >> Array ( [name] => non ferrous [id] => 32 [page_cat_id] => 10 [main_nav] => >> true [cat_name] => material range ) >> Array ( [name] => carbon based steels [id] => 33 [page_cat_id] => 10 >> [main_nav] => true [cat_name] => material range ) >> >> is it possible to build an array and use the [cat_name] as the key and >> assign all the pages to that cat_name? >> >> what im trying to achieve is a category of pages but i want the cat_name as >> the key to all the pages associated to it >> >> hope i make sense >> >> kind regards >> >> Adam > > Suppose that $arrays is your array of arrays. > Then is > $res = array(); > foreach($arrays as $item){ > $res[$item['cat_name']][] = $item; > } > what you are looking for? > > Best regards, > Jasper Mulder > > -- > 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: [PHP] Re: Fuzzy Array Search
On 06/07/2011 04:35 PM, Alex Nikitin wrote: > Shawn, == is not good for string comparison, its a bad habit that one > should get out of, use ===, its much safer . Yes, except that I was comparing a string to an array of integers :) > > Also try the same algorithm on 10 arrays of some number of values > 10-1000 perhaps, that would give you better performance statistics :) > LOOP WITH PREG MATCH: 650.627260 seconds PREG_GREP: 123.110386 seconds This was with 100,000 arrays each with 1,000 values. Of course the loop iterates through the entire loop which is needed to find all matches. If only one match is needed then you can just break out of the loop to save time. If we assume that half of the matches will be in the lower 500 and half in the upper then we can half the time for the loop but it is still 325 seconds. Thanks! -Shawn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php-cli-shebang
Windows Server 2003 PHP fastcgi 5.2 Hello, I am needing to call a php script from another language, so I am using cli. I have it basically working but have a couple questions. First, what is the (suggested) '-q' flag for in the shebang script? last, my shell is returning the actual call along with the output... which I don't want the call, just the output. ie, the call is: [dos]php-cgi.exe -f C:\\phpscript.php[/dos] 'phpscript.php' is as follows: --phpscript.php--- #!C:\\php-cgi.exe -q -- This is what is returned: C:\edc>php-cgi.exe -f C:\\phpscript.php Hello world of PHP CLI! I want only: "Hello world of PHP CLI!" Is there a way to suppress the call? Cheers, Donovan -- dbrooke -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] advice on how to build this array from an array.
On 6/7/2011 2:44 PM, Adam Preece wrote: > hi, > > thanks for your reply. > > i have figured out, well kind of, and got the data i need but the problem is > its nested within to many arrays! > > Array ( > [threads & form types] => > Array ( [0] => Array ( [name] => imperial thread form [id] => > 28 [page_cat_id] => 9 [main_nav] => true ) [1] => Array ( [name] => metric > iso threads [id] => 29 [page_cat_id] => 9 [main_nav] => true ) ) > [material range] => > Array ( [0] => Array ( [name] => super duplex stainless steels > [id] => 30 [page_cat_id] => 10 [main_nav] => true ) [1] => Array ( [name] => > standard stainless steels [id] => 31 [page_cat_id] => 10 [main_nav] => true ) > [2] => Array ( [name] => non ferrous [id] => 32 [page_cat_id] => 10 > [main_nav] => true ) [3] => Array ( [name] => carbon based steels [id] > => 33 [page_cat_id] => 10 [main_nav] => true ) ) > ) > > how can i get this just do its a $k => $v pair, > > the key as it is [threads & form types] && [material range], and the value, > the single array [Array ( [name] => imperial thread form [id] => 28 > [page_cat_id] => 9 [main_nav] => true ) [1] => Array ( [name] => metric iso > threads [id] => 29 [page_cat_id] => 9 [main_nav] => true )] ? > > hope this makes sense > > Adam > > > On 7 Jun 2011, at 22:25, Jasper Mulder wrote: > >> >> >>> From: a...@blueyonder.co.uk >>> Date: Tue, 7 Jun 2011 21:50:27 +0100 >>> To: php-general@lists.php.net >>> Subject: [PHP] advice on how to build this array from an array. >>> >>> hi all, >>> >>> please forgive me if i do not make sense, ill try my best to explain. >>> >>> >>> i have this array or arrays. >>> >>> Array ( [name] => super duplex stainless steels [id] => 30 [page_cat_id] => >>> 10 [main_nav] => true [cat_name] => material range ) >>> Array ( [name] => standard stainless steels [id] => 31 [page_cat_id] => 10 >>> [main_nav] => true [cat_name] => material range ) >>> Array ( [name] => non ferrous [id] => 32 [page_cat_id] => 10 [main_nav] => >>> true [cat_name] => material range ) >>> Array ( [name] => carbon based steels [id] => 33 [page_cat_id] => 10 >>> [main_nav] => true [cat_name] => material range ) >>> >>> is it possible to build an array and use the [cat_name] as the key and >>> assign all the pages to that cat_name? >>> >>> what im trying to achieve is a category of pages but i want the cat_name as >>> the key to all the pages associated to it >>> >>> hope i make sense >>> >>> kind regards >>> >>> Adam >> >> Suppose that $arrays is your array of arrays. >> Then is >> $res = array(); >> foreach($arrays as $item){ >> $res[$item['cat_name']][] = $item; >> } >> what you are looking for? >> >> Best regards, >> Jasper Mulder >> >> -- >> PHP General Mailing List (http://www.php.net/) >> To unsubscribe, visit: http://www.php.net/unsub.php >> > > How about showing your code? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php-cli-shebang
Lists wrote: Windows Server 2003 PHP fastcgi 5.2 O.K. '-q' is quiet mode (no header info), which works better when not using the -f flag when calling the script (it appears). anyway, I solved my issues with a work around, so no worries. Donovan -- dbrooke -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php