Re: [PHP] Looks like a bug with Smarty
if ($question == 'php') domail('phplist',$question); if ($question == 'smarty') domail('smartylist',$question); Hi All, I using html_options smarty tag to output an associative array in select drop down. Here a sample associative array: array(5) { ["CN-PEK-KEJ"]=> array(1) { [198]=> string(7) "TechTst" } ["IE-DUB-GAS"]=> array(2) { [177]=> string(10) "store room" [39]=> string(10) "TechStop 2" } ["UK-LON-BEL"]=> array(1) { [88]=> string(16) "TechStop-LON-BEL" } ["IE-DUB-GOR"]=> array(1) { [159]=> string(10) "TechStop 1" } ["US-NYC-9TH"]=> array(1) { [194]=> string(12) "TestTechStop" } } and the syntax I have used to output this was: {html_options name='locationId' options=$locations selected=$selectedLocation} where in I assign $selectedLocation with one of the options after selecting them. Even after everything being right, the option thats been selected is not set but it again goes back to show the first option after submit. Looks like either smarty misinterprets this selected option or is there something wrong from my end. Cheers -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Looks like a bug with Smarty
Hi All, I using html_options smarty tag to output an associative array in select drop down. Here a sample associative array: array(5) { ["CN-PEK-KEJ"]=> array(1) { [198]=> string(7) "TechTst" } ["IE-DUB-GAS"]=> array(2) { [177]=> string(10) "store room" [39]=> string(10) "TechStop 2" } ["UK-LON-BEL"]=> array(1) { [88]=> string(16) "TechStop-LON-BEL" } ["IE-DUB-GOR"]=> array(1) { [159]=> string(10) "TechStop 1" } ["US-NYC-9TH"]=> array(1) { [194]=> string(12) "TestTechStop" } } and the syntax I have used to output this was: {html_options name='locationId' options=$locations selected=$selectedLocation} where in I assign $selectedLocation with one of the options after selecting them. Even after everything being right, the option thats been selected is not set but it again goes back to show the first option after submit. Looks like either smarty misinterprets this selected option or is there something wrong from my end. Cheers -- Mark is on the way to make a Mark in your hearts
Re: [PHP] A stupid question?
On Fri, 2008-01-18 at 10:54 +0800, Shelley Shyan wrote: > Hi all, > > Maybe this is a somehow stupid question. > > I want to know how php could know whether session_start() has been called, > that is, whether session has been started. > > I Googled, but got little help. > > Thank you for help! > Any tip is greatly appreciated. > > Regards, > Shelley > Hey Shelley, maybe I can help you understand Sessions. When you start a Sessions PHP creates a Session ID. This is then used to create/Store information in a file or in a database. The configuration of this is in your php.ini file. If this file you can change where the session is saved as well as other options. A simple way to use Sessions is with cookies with the session.use_cookie = 1 in the php.ini file. However, if the client doesn't allow cookies there is a second way; session.use_trans_sid = 0 there are a few problems however, it creates a security risk. Anyway, I hope this opens a little on how sessions works. If you wish to learn more about sessions go to http://us2.php.net/session or http://w3schools.com/php/php_sessions.asp David Wonderly WebGenero -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Foreach
On Jan 17, 2008 11:40 PM, Jim Lucas <[EMAIL PROTECTED]> wrote: > Pastor Steve wrote: > > Here is my code: > > > > $name = $_POST['name']; > > if ($name) { > > foreach ($name as $t) { > > > > echo "$t"; > > } > > > > $order = $_POST['order']; > > if ($order) { > > foreach ($order as $i) { > > > > > > //Update the table in MySQL > > $update_data = "UPDATE sections SET `order` = '$i' WHERE name = > > '$t'"; > > $response = mysql_query( $update_data, $cnx ); > > if(mysql_error()) die ('database error'. mysql_error()); > > > > echo "$i"; > > } > > > > } > > > > } > > > > I am trying to get the information in name and order to update the > database. > > So far, I can only get one or the other. Is there a way to do this? > > > > Thanks for your help. > > > > -- > > Steve M. > > > > Your example > > > http://www.cmsws.com/examples/php/testscripts/[EMAIL PROTECTED]/0001.php > > My solution > > > http://www.cmsws.com/examples/php/testscripts/[EMAIL PROTECTED]/0002.php > > Notice the differences > > Pay close attention to the form and see how I am nesting the fields in > the input name attribute. the topic of external variables, including the ability to create arrays from outside php, such as in GET and POST requests can be found here: http://www.php.net/manual/en/language.variables.external.php -nathan
Re: [PHP] Foreach
Pastor Steve wrote: Here is my code: $name = $_POST['name']; if ($name) { foreach ($name as $t) { echo "$t"; } $order = $_POST['order']; if ($order) { foreach ($order as $i) { //Update the table in MySQL $update_data = "UPDATE sections SET `order` = '$i' WHERE name = '$t'"; $response = mysql_query( $update_data, $cnx ); if(mysql_error()) die ('database error'. mysql_error()); echo "$i"; } } } I am trying to get the information in name and order to update the database. So far, I can only get one or the other. Is there a way to do this? Thanks for your help. -- Steve M. Your example http://www.cmsws.com/examples/php/testscripts/[EMAIL PROTECTED]/0001.php My solution http://www.cmsws.com/examples/php/testscripts/[EMAIL PROTECTED]/0002.php Notice the differences Pay close attention to the form and see how I am nesting the fields in the input name attribute. Jim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Foreach
On 1/17/08, mike <[EMAIL PROTECTED]> wrote: > On 1/17/08, Nathan Nobbe <[EMAIL PROTECTED]> wrote: > > > > $name = $_POST['name']; > > > if ($name) { > > > foreach ($name as $t) { > > > > > >echo "$t"; > > >} > > > >$order = $_POST['order']; > > >if ($order) { > > >foreach ($order as $i) { > > > > > there are a few different issues here; first of all; are you sure > > $_POST['name'] > > and $_POST['order'] are even arrays? > > hint: > > if(isset($_POST['name']) && is_array($_POST['name'])) Steve, // Do you have several html form elements such as in your html? // Mike's suggestion... if( isset( $_POST['name'] ) && is_array( $_POST['name'] ) ) { // you'll never get in here if you don't... $name = $_POST['name']; // foreach expects an array, as Nathan states. Even if $name is an array, $t // will hold only the last value in the array when the foreach loop is exited // because $t is being overwritten with each iteration. foreach ($name as $t) { echo "$t"; } // end foreach ($name) $order = $_POST['order']; if ($order) { // see above about arrays and foreach foreach ($order as $i) { //Update the table in MySQL $i = mysql_real_escape_string($i, $cnx); // One of Eric's suggestions $update_data = "UPDATE sections SET `order` = '$i' WHERE name = '$t'"; $response = mysql_query( $update_data, $cnx ); if(mysql_error()) die ('database error'. mysql_error()); echo "$i"; } //end foreach ($order) } } Assuming both $_POST['name'] and $_POST['order'] are arrays, the way your code is now structured, the table `sections` will have the record(s) where name equals the last value in the $names array updated multiple times, once for each value in the $order array, but all you will see is that the record(s) will have the last value in the $order array. See if this makes any sense and then ask more questions. David
Re: [PHP] A stupid question?
Shelley Shyan wrote: Hi all, Maybe this is a somehow stupid question. I want to know how php could know whether session_start() has been called, that is, whether session has been started. I Googled, but got little help. Thank you for help! Any tip is greatly appreciated. Regards, Shelley http://us3.php.net/session_id is what you are looking for. Look at the notes for the "Return Values" section "session_id() returns the session id for the current session or the empty string ("") if there is no current session (no current session id exists)." So, something like this will do. Jim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] A stupid question?
Hi all, Maybe this is a somehow stupid question. I want to know how php could know whether session_start() has been called, that is, whether session has been started. I Googled, but got little help. Thank you for help! Any tip is greatly appreciated. Regards, Shelley
Re: [PHP] Function-return-array idea
Jim Lucas wrote: I think this would be an easier/quicker fix for you then requesting that the PHP developers re-write a large portion of the way PHP currently works. Here is the reference that I have been looking for. http://en.wikipedia.org/wiki/Message_passing Jim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: system command runs application, but application doesn't work correctly
Richard Lynch l-i-e.com> writes: > > Try writing a 2-line .sh (shell) script that does what you want, and > call that 2-liner from exec(). Thanks for idea, Richard. But it doesn't work. I wrote code as you said: $first = "/usr/local/bin/mencoder -vf scale=448:-3,expand=448:336 -sws 9 -of lavf -ovc lavc -lavcopts vcodec=flv:vbitrate=250:trell:v4mv:mv0:mbd=2:cbp:aic:cmp=3:subcmp=3:vpass=1 -frames 800 -ofps 24000/1001 -oac mp3lame -lameopts abr:br=64:mode=0 -channels 1 -srate 22050 -of lavf -lavfopts format=flv -o ".$outputFile." /home/re/ff/logo7.avi ".$inputFile."\n"; $second = "/usr/local/bin/mencoder -vf scale=448:-3,expand=448:336 -sws 9 -of lavf -ovc lavc -lavcopts vcodec=flv:vbitrate=250:trell:v4mv:mv0:mbd=2:cbp:aic:cmp=3:subcmp=3:vpass=2 -frames 800 -ofps 24000/1001 -oac mp3lame -lameopts abr:br=64:mode=0 -channels 1 -srate 22050 -of lavf -lavfopts format=flv -o ".$outputFile." /home/re/ff/logo7.avi ".$inputFile; $fp = fopen("/home/re/video/enc", "w"); fwrite($fp, $first); fwrite($fp, $second); fclose($fp); exec("/bin/bash /home/re/video/enc"); I've also tried system() instead of exec(), and it displayed same output text as I posted above. The strangest thing is when I run this script from shell, everything works fine! Video encodes well. But when I call that script from PHP, nothing works. Another strange thing is I run ImageMajick with system() in a lot of scripts on the same server and everything works fine. What is the problem? Do you have any idea? > > On Thu, January 17, 2008 6:46 am, Apple wrote: > > Daniel Brown gmail.com> writes: > > > >> Try replacing system() with die() and letting it print out the > >> information full command string. That may give you an idea of a > >> variable that's either incorrect or undefined. If you copy and > >> paste > >> it and run the command from the command line and it works, then it > >> may > >> be permissions issues. > > > > Daniel, > > > > This doesn't display anything: > > die($first); > > die($second); > > > > Full commands are: > > first: /usr/local/bin/mencoder -vf scale=448:-3,expand=448:336 -sws 9 > > -of lavf > > -ovc lavc -lavcopts > > vcodec=flv:vbitrate=250:trell:v4mv:mv0:mbd=2:cbp:aic:cmp=3:subcmp=3:vpass=1 > > -frames 800 -ofps 24000/1001 -oac mp3lame -lameopts abr:br=64:mode=0 > > -channels 1 > > -srate 22050 -of lavf -lavfopts format=flv -o /home/re/video/2/16.flv > > /home/re/ff/logo7.avi /home/re/video/2/16temp > > > > second: > > /usr/local/bin/mencoder -vf scale=448:-3,expand=448:336 -sws 9 -of > > lavf -ovc > > lavc -lavcopts > > vcodec=flv:vbitrate=250:trell:v4mv:mv0:mbd=2:cbp:aic:cmp=3:subcmp=3:vpass=1 > > -frames 800 -ofps 24000/1001 -oac mp3lame -lameopts abr:br=64:mode=0 > > -channels 1 > > -srate 22050 -of lavf -lavfopts format=flv -o /home/re/video/2/16.flv > > /home/re/ff/logo7.avi /home/re/video/2/16temp > > > > > > I've set permissions of all test files and directories to 777. But > > still my > > script doesn't work. > > > > > > > > > >> > >> One part of the snipped content that I noticed kept repeating is > >> the following (and actually ending with this line): > >> 'VDecoder init failed :( Read DOCS/HTML/en/codecs.html' > >> > >> Did you follow the advice and read that document? > > > > Yes. It's just describes codecs. But I know mencoder support those > > codecs, > > because it encodes videos when it's called from SSH. > > > > > >> Beyond that, it's a question that should probably instead be > >> asked > >> on a mencoder mailing list, since PHP's system() function is working > >> correctly, but apparently isn't getting the information it needs to > >> pass stuff back-and-forth with the system. > >> > > > > > > > > > > I've already asked this question in Mencoder group, by noone replied. > > > > I thinkit's because mencoder works fine and it doesn't work only when > > I call it > > from PHP. > > > > The thing is when I copy/paste commands above to SSH, everything works > > fine. > > > > Do you have any thoughts? > > > > -- > > 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] Foreach
On 1/17/08, Nathan Nobbe <[EMAIL PROTECTED]> wrote: > > $name = $_POST['name']; > > if ($name) { > > foreach ($name as $t) { > > > >echo "$t"; > >} > >$order = $_POST['order']; > >if ($order) { > >foreach ($order as $i) { > > there are a few different issues here; first of all; are you sure > $_POST['name'] > and $_POST['order'] are even arrays? hint: if(isset($_POST['name']) && is_array($_POST['name'])) :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Foreach
On Jan 17, 2008 5:57 PM, Nathan Nobbe <[EMAIL PROTECTED]> wrote: > there are a few different issues here; first of all; are you sure > $_POST['name'] > and $_POST['order'] are even arrays? To check try this right above your saving code block: echo ''; print_r($_POST); After you figure out if your data is right we're going to have to talk about input validation and sql injection. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Foreach
On Jan 17, 2008 5:49 PM, Pastor Steve <[EMAIL PROTECTED]> wrote: > Here is my code: > > $name = $_POST['name']; > if ($name) { > foreach ($name as $t) { > >echo "$t"; >} > >$order = $_POST['order']; >if ($order) { >foreach ($order as $i) { > > >//Update the table in MySQL >$update_data = "UPDATE sections SET `order` = '$i' WHERE name = > '$t'"; >$response = mysql_query( $update_data, $cnx ); >if(mysql_error()) die ('database error'. mysql_error()); > >echo "$i"; >} > > } > > } > > I am trying to get the information in name and order to update the > database. > So far, I can only get one or the other. Is there a way to do this? there are a few different issues here; first of all; are you sure $_POST['name'] and $_POST['order'] are even arrays? -nathan
[PHP] Foreach
Here is my code: $name = $_POST['name']; if ($name) { foreach ($name as $t) { echo "$t"; } $order = $_POST['order']; if ($order) { foreach ($order as $i) { //Update the table in MySQL $update_data = "UPDATE sections SET `order` = '$i' WHERE name = '$t'"; $response = mysql_query( $update_data, $cnx ); if(mysql_error()) die ('database error'. mysql_error()); echo "$i"; } } } I am trying to get the information in name and order to update the database. So far, I can only get one or the other. Is there a way to do this? Thanks for your help. -- Steve M. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Function-return-array idea
On Jan 16, 2008 6:32 PM, Stijn Leenknegt <[EMAIL PROTECTED]> wrote: > Hello > > I've an idea for PHP6. Let's kickoff with an example. > > $info = getUserInformation($id); //return an array with all the > information > of an user. > echo $info['naam']; > ?> > > This is nice, but when I want one element of the returned array, I have to > store the returned array into a variable and then call the variable. > The next code example is my idea. > > echo getUserInformation($id)['naam']; > ?> > > Let's look further then this small example. > > echo $object->fetchObjects()[0]->method(); > ?> > > This example is more realistic when you use OO. This code style is faster > for developing applications. This code style is available in Java, > Javascript, C, C++, Perl, Python, ... So why not in PHP(6)? You can read > more on my blog i think this is pretty much a dup of a thread from about a week ago; http://www.nabble.com/Why-is-some_function()-some_index--invalid-syntax--td14749459.html -nathan
Re: [PHP] Function-return-array idea
On Jan 16, 2008 6:32 PM, Stijn Leenknegt <[EMAIL PROTECTED]> wrote: > Hello > > I've an idea for PHP6. Let's kickoff with an example. > > $info = getUserInformation($id); //return an array with all the information > of an user. > echo $info['naam']; > ?> > > This is nice, but when I want one element of the returned array, I have to > store the returned array into a variable and then call the variable. > The next code example is my idea. > > echo getUserInformation($id)['naam']; > ?> > > Let's look further then this small example. > > echo $object->fetchObjects()[0]->method(); > ?> > > This example is more realistic when you use OO. This code style is faster > for developing applications. This code style is available in Java, > Javascript, C, C++, Perl, Python, ... So why not in PHP(6)? You can read > more on my blog. > > http://www.eos-team.org/2007/09/06/php6-function-return-array-idea.html > > I hope for good response and also response from php-dev team. > > Greetings > Stijn Leenknegt > My reply is a bit pointless as I'd never do/rely on this. But nonetheless it was an interesting test. function testObj() { $arr = array(); $arr['key1'] = array(1, 2, 3); $arr['key3'] = array('a','b','c'); return (object)$arr; } echo ''; echo "Key1: \n"; print_r(testObj()->key1); echo "Key3: \n"; print_r(testObj()->key3); --- output Key1: Array ( [0] => 1 [1] => 2 [2] => 3 ) Key3: Array ( [0] => a [1] => b [2] => c ) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SMTP vs mail()
Hello, on 01/17/2008 06:57 PM Richard Lynch said the following: > On Thu, January 17, 2008 3:50 am, Richard Heyes wrote: >>> You can easily make a mail queue in php yourself with a daemon that >>> checks the queue and sends waiting mail in batches of say 200 per >>> minute. (provided you have access to the cli on the server) >> Why when there MTAs? > > Your shared host may provide no access to config an MTA, but will shut > you down automatically if you send either more then 75 emails per > minute, or more than 1000 per hour. > > I worked on such a setup, and crafted a PHP DB queue of emails to make > 100% sure their mailing list never got their site shut down. > > I am confident other examples abound. You are right. After all that is an "MTA" too. It is an awkward solution but tt least you will be able work around your ISP constraints. Some time ago an user published a class that does precisely that: http://www.phpclasses.org/newsletter In the past, I used also an unsual solution to send newsletters to the PHPClasses site users. Instead of a database, I used to send e-mail messages that contained newsletter contents and subscriber addresses. Then I used my desktop machine to pop the messages and distribute the newsletters. When it exceeded my ISP limits, I used servers borrowed from kind users, until I finally used a VPS. The distribution system via e-mail still exists and works as a charm, although for now it is not needed to work distributedly. In this blog post you can read all the details. http://www.phpclasses.org/blog/post/65-8-defensive-programming-best-practices-to-prevent-breaking-your-sites.html -- Regards, Manuel Lemos PHP professionals looking for PHP jobs http://www.phpclasses.org/professionals/ PHP Classes - Free ready to use OOP components written in PHP http://www.phpclasses.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: system command runs application, but application doesn't work correctly
Try writing a 2-line .sh (shell) script that does what you want, and call that 2-liner from exec(). On Thu, January 17, 2008 6:46 am, Apple wrote: > Daniel Brown gmail.com> writes: > >> Try replacing system() with die() and letting it print out the >> information full command string. That may give you an idea of a >> variable that's either incorrect or undefined. If you copy and >> paste >> it and run the command from the command line and it works, then it >> may >> be permissions issues. > > Daniel, > > This doesn't display anything: > die($first); > die($second); > > Full commands are: > first: /usr/local/bin/mencoder -vf scale=448:-3,expand=448:336 -sws 9 > -of lavf > -ovc lavc -lavcopts > vcodec=flv:vbitrate=250:trell:v4mv:mv0:mbd=2:cbp:aic:cmp=3:subcmp=3:vpass=1 > -frames 800 -ofps 24000/1001 -oac mp3lame -lameopts abr:br=64:mode=0 > -channels 1 > -srate 22050 -of lavf -lavfopts format=flv -o /home/re/video/2/16.flv > /home/re/ff/logo7.avi /home/re/video/2/16temp > > second: > /usr/local/bin/mencoder -vf scale=448:-3,expand=448:336 -sws 9 -of > lavf -ovc > lavc -lavcopts > vcodec=flv:vbitrate=250:trell:v4mv:mv0:mbd=2:cbp:aic:cmp=3:subcmp=3:vpass=1 > -frames 800 -ofps 24000/1001 -oac mp3lame -lameopts abr:br=64:mode=0 > -channels 1 > -srate 22050 -of lavf -lavfopts format=flv -o /home/re/video/2/16.flv > /home/re/ff/logo7.avi /home/re/video/2/16temp > > > I've set permissions of all test files and directories to 777. But > still my > script doesn't work. > > > > >> >> One part of the snipped content that I noticed kept repeating is >> the following (and actually ending with this line): >> 'VDecoder init failed :( Read DOCS/HTML/en/codecs.html' >> >> Did you follow the advice and read that document? > > Yes. It's just describes codecs. But I know mencoder support those > codecs, > because it encodes videos when it's called from SSH. > > >> Beyond that, it's a question that should probably instead be >> asked >> on a mencoder mailing list, since PHP's system() function is working >> correctly, but apparently isn't getting the information it needs to >> pass stuff back-and-forth with the system. >> > > > > > I've already asked this question in Mencoder group, by noone replied. > > I thinkit's because mencoder works fine and it doesn't work only when > I call it > from PHP. > > The thing is when I copy/paste commands above to SSH, everything works > fine. > > Do you have any thoughts? > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] snmp_set_valueretrieval depends on what?
fumble-fingers! http://lxr.php.net/ On Wed, January 16, 2008 9:18 pm, Dotan Cohen wrote: > On 16/01/2008, Richard Lynch <[EMAIL PROTECTED]> wrote: >> You can check at http://xlr.php.net but I suspect that it's too >> "new" >> to be in your version of PHP. >> >> You are on 5.2.1 and php.net is offering 5.2.5, so you're just >> enough >> behind for this to be very plausible. >> >> Maybe get Ubuntu to catch up? :-) >> > > Thanks, Richard. That link seems broken, are you sure that it is > correct? > > Dotan Cohen > > http://what-is-what.com > http://gibberish.co.il > ×-×-×-×-×-×-×-×-×-×-×-×-×-×-×-×-× -ס-×¢-×£-פ-×¥-צ-ק-ר-ש-ת > > A: Because it messes up the order in which people normally read text. > Q: Why is top-posting such a bad thing? > -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] New years resolution: To get serious with my programming! Anyone wanna help? :)
On Jan 17, 2008 4:01 PM, Richard Lynch <[EMAIL PROTECTED]> wrote: > And I don't recall the answer, and don't give a [bleep] since it's > almost never the bottleneck in an application in the first place... You swore. I'm tellin' Mom. -- Daniel P. Brown Senior Unix Geek and #1 Rated "Year's Coolest Guy" By Self Since Nineteen-Seventy-[mumble]. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP array entries max limit
On Wed, January 16, 2008 11:02 pm, Prabath Kumarasinghe wrote: > I would like to know how many entries does PHP associative array can > handle. As far as I know, the answer is: How much RAM do you have? -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] New years resolution: To get serious with my programming! Anyone wanna help? :)
On Thu, January 17, 2008 2:06 am, Jochem Maas wrote: > Richard Lynch schreef: >> On Wed, January 16, 2008 9:57 am, Daniel Brown wrote: >>> echo($h."\n".$i."\n"); // echo is a construct, but as expected, can >>> use parentheses() >> >> Just to be picuyane: >> >> echo isn't using the parens. >> >> The parens are forcing PHP to evaluate the concatenation of the >> strings FIRST, and then echo them. >> >> And since the concatenation operator takes precedence over the >> language construct, the parens are basically useless cruft. > > not to mention that it should be written as (spaces are optional ;-)): > > echo $h, "\n", $i, "\n"; > > which avoids any concat operation and dumps the result of each > expression > direct to the buffer :-) I wanted to avoid the whole concat versus multi-arg performance thread, since it usually takes about a week before somebody posts the definitive answer, showing the actual PHP opcodes generated... And I don't recall the answer, and don't give a [bleep] since it's almost never the bottleneck in an application in the first place... -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SMTP vs mail()
On Thu, January 17, 2008 3:50 am, Richard Heyes wrote: >> You can easily make a mail queue in php yourself with a daemon that >> checks the queue and sends waiting mail in batches of say 200 per >> minute. (provided you have access to the cli on the server) > > Why when there MTAs? Your shared host may provide no access to config an MTA, but will shut you down automatically if you send either more then 75 emails per minute, or more than 1000 per hour. I worked on such a setup, and crafted a PHP DB queue of emails to make 100% sure their mailing list never got their site shut down. I am confident other examples abound. -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Count
Steve, Check out the while loop (http://us.php.net/manual/en/control-structures.while.php). It'll do what you need. -- Mike -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Count
Richard, Thank you so much for your response. The select would be created from the number of records in the db. $variable2 The problem that I am having is rather than getting just the number of records, which is 3 currently, I would like it to be 1 for the first option, 2 for the second..., so that the user has the choice of any record. The idea would be to order the content by the highest number. I hope this makes more sense. -- Steve M. on 1/17/08 1:54 PM Richard Heyes ([EMAIL PROTECTED]) wrote: >> > I am wanting to create an select menu for displaying the order of the item >> > on a page. I am guessing that I need to get the count of how many items are >> > in the db and them put them into a select menu. > > Your question doesn't really make a great deal of sense. Your SQL could be: > > SELECT COUNT(*) FROM your_table WHERE 1 > > Which will give you a single numeric value back (the number of rows). To > put them into an HTML page: > > > Choose... > Foo > > > This is a very basic select. You can simply loop through your query > results adding more option tags to add more items to the select.
Re: [PHP] changing the ini from a file
""Daniel Brown"" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] On Jan 16, 2008 12:02 PM, Jim Lucas <[EMAIL PROTECTED]> wrote: Jim Lucas wrote: > Wolf wrote: >> I'm using .htaccess to do >> php_value auto_prepend_file "auth.php" >> >> The problem is that there are very specific files that I want to be >> able to NOT run that in. I guess I could just move them to a >> directory and use .htaccess to perform a php_value auto_prepend_file >> "" >> >> But I was hoping to not have to make a separate folder for that. >> Anyone encoutered being able to change/disable the setting on the fly >> in a specific file? >> >> Thanks! >> >> Wolf >> > > Just had an interesting way of solving this problem come to mind. > > I would like others to way in on this. > > You can do this completely from within apache. > > For the pages that you want to have auth.php included with, give them > and extension of .phtml or something else... > > Then, configure apache to allow php to process those like this > > AddType application/x-httpd-php .php > AddType application/x-httpd-php .phtml > > then in apache, could be in httpd.conf or .htaccess have something like > this. > > > > php_value auto_prepend_file "auth.php" > > > When finished, restart apache and you should be good to go. > > I would try something like this. Should work, others might have better > ideas. > Now that I am looking at this a second time. Couldn't all this apache stuff be done in the .htaccess file? Just place all the following in a .htaccess file, then change the extension on the file(s) that you want to have work this way. I don't think you need to touch the httpd.conf file at all. AddType application/x-httpd-php .php AddType application/x-httpd-php .phtml php_value auto_prepend_file "auth.php" Then all of the links or includes would have to be updated to handle the .phtml extension change, too. Good idea, but it sounds to be like what he's asking unfortunately just isn't possible without some form of major overhaul. -- Well, at least it will be usefull next time someone does a project in which they want to auto-add a header, or some authorization code. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Count
I am wanting to create an select menu for displaying the order of the item on a page. I am guessing that I need to get the count of how many items are in the db and them put them into a select menu. Your question doesn't really make a great deal of sense. Your SQL could be: SELECT COUNT(*) FROM your_table WHERE 1 Which will give you a single numeric value back (the number of rows). To put them into an HTML page: Choose... Foo This is a very basic select. You can simply loop through your query results adding more option tags to add more items to the select. -- Richard Heyes http://www.websupportsolutions.co.uk Mailing list management service allowing you to reach your Customers and increase your sales. ** NOW OFFERING FREE ACCOUNTS TO CHARITIES AND NON-PROFITS ** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Count
Greetings, I am wanting to create an select menu for displaying the order of the item on a page. I am guessing that I need to get the count of how many items are in the db and them put them into a select menu. Does anyone know how to do this or can point me in the right direction? I hope this makes sense. -- Steve M.
[PHP] Re: How to take video embed codes and change all their widths/heights?
"Rob Gould" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Can anytime give me some insights on how to write a PHP script that could accept any of the below strings below and edit the strings to change their width and height settings dynamically? For instance, if I want all embedded videos to have a width of 320, and a height of 240, using PHP's string manipulation commands, what's the best way to "hone in" on width="425" and change it to width="320"? (In all cases in each string) stringtoedit='value="http://www.youtube.com/v/B1O2jcfOylU&rel=1";>name="wmode" value="transparent">src="http://www.youtube.com/v/B1O2jcfOylU&rel=1 " type="application/x-shockwave-flash" wmode="transparent" width="425" height="355">'; stringtoedit='value="http://www2.funnyordie.com/public/flash/fodplayer.swf " />name="flashvars" value="key=5468" />value="true" />allowfullscreen="true" quality="high" src="http://www2.funnyordie.com/public/flash/fodplayer.swf " type="application/x-shockwave-flash">href="http://www.funnyordie.com/videos/5468";>Cars on href="http://www.funnyordie.com ">FunnyOrDie.com'; If you only have those two types that you need to imbed then it might be easier to make a function EmbedYoutubeCode( 'B1O2jcfOylU' ) since the only thing that changes is the ID number near the end of the url, your function could just spit out function EmbedYoutubeCode( MovieID: String): String; { 'object width="425" height="355">value="http://www.youtube.com/v/' + MovieID + '&rel=1">name="wmode" value="transparent">src="http://www.youtube.com/v/' + MovieID + '&rel=1" type="application/x-shockwave-flash" wmode="transparent" width="425" height="355">'; } Basiclly you just give it the ID, and it would spit back out the embed code, it also makes for safer code since you coudl also check to make sure that there was no urls or other junk so it's harder to get hacked. Oh, and sorry about half of that function being written in Pascal, I've been working with it all morning. - Dan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Encryption failing
(forgot to copy the list) On Jan 16, 2008, at 5:08 PM, Richard Lynch wrote: Is it possible that 4% of the time, you have spaces on the start/end of the string, which get trimmed before encryption? In this case, no. In trying to simplify the situation to narrow the possibilities of error, I am generating "random" character strings of only alphanumeric (or numeric-only) characters. Each is exactly 16 characters. And if rijndael is one of the algorithms which requires a fixed-size input, that also would be "bad" to trim it. No documentation that I was able to find suggests that requirement. Actually, I'd suggest that the encryption function has no business trimming the text anyway. Philosophically I agree with you, but mCrypt has this nasty habit of appending bunches of nulls to the decrypted string. So philosophical purity gives way to practical application. Good ideas, as usual. Thank you. Ken -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Hashes and character encodings
Naz Gassiep wrote: > When passing strings to md5() or sha1() do the strings get coerced to > utf8 for hashing, or does that not matter? No and no. > Does anyone have a URL that comprehensively deals with this issue? There is no issue. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Match anything between two " that is not a " exceptifitisescaped...
mathieu leddet schreef: Yes Jochem, I *now* know what "lookbehind" and "lookahead" assertions are. I think I am *now* able to use them when needed. yeah! (give a man a fish he eats for a day, teach him how to fish and he'll eat forever - or until he empties the north sea [in the case of dutch fishermen :-(]) Max, thanks for the link. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Match anything between two " that is not a " exceptif it is escaped...
Per Jessen wrote: Max Antonov wrote: (what mean abbreviation OP? can send direcly to my mailbox) Original Poster. /Per Jessen, Zürich Thats what it means? I assumed it meant "Operator". Oh well -- Jim Lucas "Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them." Twelfth Night, Act II, Scene V by William Shakespeare -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Hashes and character encodings
When passing strings to md5() or sha1() do the strings get coerced to utf8 for hashing, or does that not matter? Does anyone have a URL that comprehensively deals with this issue? - Naz. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: Match anything between two " that is not a " exceptifitisescaped...
Yes Jochem, I *now* know what "lookbehind" and "lookahead" assertions are. I think I am *now* able to use them when needed. Max, thanks for the link. -- Mathieu || _| |_ / \ | | | | | | | | | | | | |__| ;) -Message d'origine- De : Max Antonov [mailto:[EMAIL PROTECTED] Envoyé : Thursday, January 17, 2008 3:04 PM À : php-general@lists.php.net Objet : Re: [PHP] Re: Match anything between two " that is not a " exceptifitisescaped... Jochem Maas : > mathieu leddet schreef: >> Thanks a lot Max (and Jochem), you solved my issue. >> > PS - you solved the issue but did you learn what a [negative] look > behind assertion is? Mathieu, I agree with Jochem. If you periodicaly solve issues, such this - you must know about behind assertions in pcre. I ask google, and google give me good manual. http://www.pcre.org/pcre.txt open this page and use brouser search interface to find section PCREPATTERN or PCRE REGULAR EXPRESSION DETAILS it is best manual about PCRE (IMHO) But I don't know - is php pcre fully compatible with pcre library. Also see documentation in php.net :) -- 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: Match anything between two " that is not a " exceptifitis escaped...
Jochem Maas : mathieu leddet schreef: Thanks a lot Max (and Jochem), you solved my issue. PS - you solved the issue but did you learn what a [negative] look behind assertion is? Mathieu, I agree with Jochem. If you periodicaly solve issues, such this - you must know about behind assertions in pcre. I ask google, and google give me good manual. http://www.pcre.org/pcre.txt open this page and use brouser search interface to find section PCREPATTERN or PCRE REGULAR EXPRESSION DETAILS it is best manual about PCRE (IMHO) But I don't know - is php pcre fully compatible with pcre library. Also see documentation in php.net :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Match anything between two " that is not a " exceptifit is escaped...
mathieu leddet schreef: Thanks a lot Max (and Jochem), you solved my issue. Cheers from Bordeaux in France ! send us a bottle of your finest ;-) PS - you solved the issue but did you learn what a [negative] look behind assertion is? I didn't give you the regexp in the hope you'd be able to figure it out yourself once you knew the terminology to search for. -- Mathieu, learning everyday. -Message d'origine- De : Max Antonov [mailto:[EMAIL PROTECTED] Envoyé : Thursday, January 17, 2008 12:36 PM À : php-general@lists.php.net Objet : Re: [PHP] Re: Match anything between two " that is not a " exceptifit is escaped... Jochem Maas writes: attend? don't understand what you mean BUT you have given the OP the answer by changing his regexp to include a [negative] look behind assertion for the backslash. :-) I hope, my regular expression answer the purpose, than need Mathieu (what mean abbreviation OP? can send direcly to my mailbox) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: system command runs application, but application doesn't work correctly
Daniel Brown gmail.com> writes: > Try replacing system() with die() and letting it print out the > information full command string. That may give you an idea of a > variable that's either incorrect or undefined. If you copy and paste > it and run the command from the command line and it works, then it may > be permissions issues. Daniel, This doesn't display anything: die($first); die($second); Full commands are: first: /usr/local/bin/mencoder -vf scale=448:-3,expand=448:336 -sws 9 -of lavf -ovc lavc -lavcopts vcodec=flv:vbitrate=250:trell:v4mv:mv0:mbd=2:cbp:aic:cmp=3:subcmp=3:vpass=1 -frames 800 -ofps 24000/1001 -oac mp3lame -lameopts abr:br=64:mode=0 -channels 1 -srate 22050 -of lavf -lavfopts format=flv -o /home/re/video/2/16.flv /home/re/ff/logo7.avi /home/re/video/2/16temp second: /usr/local/bin/mencoder -vf scale=448:-3,expand=448:336 -sws 9 -of lavf -ovc lavc -lavcopts vcodec=flv:vbitrate=250:trell:v4mv:mv0:mbd=2:cbp:aic:cmp=3:subcmp=3:vpass=1 -frames 800 -ofps 24000/1001 -oac mp3lame -lameopts abr:br=64:mode=0 -channels 1 -srate 22050 -of lavf -lavfopts format=flv -o /home/re/video/2/16.flv /home/re/ff/logo7.avi /home/re/video/2/16temp I've set permissions of all test files and directories to 777. But still my script doesn't work. > > One part of the snipped content that I noticed kept repeating is > the following (and actually ending with this line): > 'VDecoder init failed :( Read DOCS/HTML/en/codecs.html' > > Did you follow the advice and read that document? Yes. It's just describes codecs. But I know mencoder support those codecs, because it encodes videos when it's called from SSH. > Beyond that, it's a question that should probably instead be asked > on a mencoder mailing list, since PHP's system() function is working > correctly, but apparently isn't getting the information it needs to > pass stuff back-and-forth with the system. > I've already asked this question in Mencoder group, by noone replied. I thinkit's because mencoder works fine and it doesn't work only when I call it from PHP. The thing is when I copy/paste commands above to SSH, everything works fine. Do you have any thoughts? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: Match anything between two " that is not a " exceptifit is escaped...
Thanks a lot Max (and Jochem), you solved my issue. Cheers from Bordeaux in France ! -- Mathieu, learning everyday. -Message d'origine- De : Max Antonov [mailto:[EMAIL PROTECTED] Envoyé : Thursday, January 17, 2008 12:36 PM À : php-general@lists.php.net Objet : Re: [PHP] Re: Match anything between two " that is not a " exceptifit is escaped... Jochem Maas writes: > attend? don't understand what you mean BUT you have given the OP the > answer by changing his regexp to include a [negative] look behind assertion > for the backslash. :-) I hope, my regular expression answer the purpose, than need Mathieu (what mean abbreviation OP? can send direcly to my mailbox) -- Max Anotnov (idler at instanceof dot ru) -- 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: Match anything between two " that is not a " exceptif it is escaped...
Max Antonov wrote: > (what mean abbreviation OP? can send direcly to my mailbox) Original Poster. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Match anything between two " that is not a " exceptif it is escaped...
Jochem Maas writes: attend? don't understand what you mean BUT you have given the OP the answer by changing his regexp to include a [negative] look behind assertion for the backslash. :-) I hope, my regular expression answer the purpose, than need Mathieu (what mean abbreviation OP? can send direcly to my mailbox) -- Max Anotnov (idler at instanceof dot ru) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Match anything between two " that is not a " except if it is escaped...
Max Antonov schreef: mathieu leddet writes: Hi everyone, I am struggling with regular expression trying to match strings delimited by double quotes, but taking into consideration that \" is not a string ending character. .. // pattern for catching strings between " $pattern = '#"([^"]*)"#'; . $out contains : this is a string : "Hi everyone my name is \"Mathieu\"!" Here is a second string : "PHP is just perfect" . -- Mathieu If I right understand you scope. (yes, my English is bad) better than our russian. You hope to get result such as: this is a string : "Hi everyone my name is \"Mathieu\"!" Here is a second string : "PHP is just perfect" I try to fix you regular expression. $pattern = '#"(.*?)(?<=[^])"#is'; attend to this: (?<=[^]) attend? don't understand what you mean BUT you have given the OP the answer by changing his regexp to include a [negative] look behind assertion for the backslash. :-) when PHP compile this string - inside it looks like (?<=[^\\]) when regular expression compile inside pcre library it looks like #"(.*?)(?<=[^\])"#is this part: (?<=[^\])" is mean folow: double quote, which not have leading backslash. see folow: [EMAIL PROTECTED]:~$ cat preg.php "${1}"'; // perform the reg exp replacement $out = preg_replace($pattern, $replacement, $in); echo $out,"\n\n"; [EMAIL PROTECTED]:~$ php preg.php this is a string : "Hi everyone my name is \"Mathieu\"!" Here is a second string : "PHP is just perfect" Is this rigth? -- Max Anotnov (idler at instanceof dot ru) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Match anything between two " that is not a " except if it is escaped...
mathieu leddet writes: Hi everyone, I am struggling with regular expression trying to match strings delimited by double quotes, but taking into consideration that \" is not a string ending character. .. // pattern for catching strings between " $pattern = '#"([^"]*)"#'; . $out contains : this is a string : "Hi everyone my name is \"Mathieu\"!" Here is a second string : "PHP is just perfect" . -- Mathieu If I right understand you scope. (yes, my English is bad) You hope to get result such as: this is a string : "Hi everyone my name is \"Mathieu\"!" Here is a second string : "PHP is just perfect" I try to fix you regular expression. $pattern = '#"(.*?)(?<=[^])"#is'; attend to this: (?<=[^]) when PHP compile this string - inside it looks like (?<=[^\\]) when regular expression compile inside pcre library it looks like #"(.*?)(?<=[^\])"#is this part: (?<=[^\])" is mean folow: double quote, which not have leading backslash. see folow: [EMAIL PROTECTED]:~$ cat preg.php "${1}"'; // perform the reg exp replacement $out = preg_replace($pattern, $replacement, $in); echo $out,"\n\n"; [EMAIL PROTECTED]:~$ php preg.php this is a string : "Hi everyone my name is \"Mathieu\"!" Here is a second string : "PHP is just perfect" Is this rigth? -- Max Anotnov (idler at instanceof dot ru) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SMTP vs mail()
You can easily make a mail queue in php yourself with a daemon that checks the queue and sends waiting mail in batches of say 200 per minute. (provided you have access to the cli on the server) Why when there MTAs? -- Richard Heyes http://www.websupportsolutions.co.uk Mailing list management service allowing you to reach your Customers and increase your sales. ** NOW OFFERING FREE ACCOUNTS TO CHARITIES AND NON-PROFITS ** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Match anything between two " that is not a " except if it is escaped...
mathieu leddet schreef: Hi everyone, I am struggling with regular expression trying to match strings delimited by double quotes, but taking into consideration that \" is not a string ending character. STFW for the concept "look behind assertion" - that is what you need to differentiate between an escaped double-quote and the delimiting double quote. ---8<--- - $in = 'this is a string : "Hi everyone my name is \"Mathieu\"!" Here is a second string : "PHP is just perfect"'; // pattern for catching strings between " $pattern = '#"([^"]*)"#'; // surround matching string with HTML span code to highlight $replacement = '"${1}"'; // perform the reg exp replacement $out = preg_replace($pattern, $replacement, $in); ---8<--- - $out contains : this is a string : "Hi everyone my name is \"Mathieu\"!" Here is a second string : "PHP is just perfect" This behaviour is normal considering my pattern (anything between two " that is not a "). But I don't know how to get this : this is a string : "Hi everyone my name is \"Mathieu\"!" Here is a second string : "PHP is just perfect" I would like my pattern to express : Anything between two " that is not a " except if it is escaped. Thanks for reading me, any help in return is welcome ! -- Mathieu -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Match anything between two " that is not a " except if it is escaped...
Hi everyone, I am struggling with regular expression trying to match strings delimited by double quotes, but taking into consideration that \" is not a string ending character. ---8<--- - $in = 'this is a string : "Hi everyone my name is \"Mathieu\"!" Here is a second string : "PHP is just perfect"'; // pattern for catching strings between " $pattern = '#"([^"]*)"#'; // surround matching string with HTML span code to highlight $replacement = '"${1}"'; // perform the reg exp replacement $out = preg_replace($pattern, $replacement, $in); ---8<--- - $out contains : this is a string : "Hi everyone my name is \"Mathieu\"!" Here is a second string : "PHP is just perfect" This behaviour is normal considering my pattern (anything between two " that is not a "). But I don't know how to get this : this is a string : "Hi everyone my name is \"Mathieu\"!" Here is a second string : "PHP is just perfect" I would like my pattern to express : Anything between two " that is not a " except if it is escaped. Thanks for reading me, any help in return is welcome ! -- Mathieu -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] New years resolution: To get serious with my programming! Anyone wanna help? :)
Richard Lynch schreef: On Wed, January 16, 2008 9:57 am, Daniel Brown wrote: echo($h."\n".$i."\n"); // echo is a construct, but as expected, can use parentheses() Just to be picuyane: echo isn't using the parens. The parens are forcing PHP to evaluate the concatenation of the strings FIRST, and then echo them. And since the concatenation operator takes precedence over the language construct, the parens are basically useless cruft. not to mention that it should be written as (spaces are optional ;-)): echo $h, "\n", $i, "\n"; which avoids any concat operation and dumps the result of each expression direct to the buffer :-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP array entries max limit
Prabath Kumarasinghe wrote: > Hi All > > I would like to know how many entries does PHP associative array can > handle. Why don't you just test it? for( $i=0; ; $i++ ) { $kk[$i]=1; } Attempt#1 - 13 keys, stopped due to memory limit *M. Attempt#2 - 838 keys, memlimit 512M. Attempt#3 - 2958 keys, memlimit 2G. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php