Re: [PHP] How can I submit more than 2000 items of data?
Check this http://www.php.net/manual/en/ini.core.php#ini.post-max-size On Mon, Aug 19, 2013 at 9:55 AM, aesbovis aesbo...@gmail.com wrote: Hello there I am making a little web-based-tool for our studio to progress a large amount of data, more than 2000 items, but it seems there is a length limit of 1000 to $_POST. How can I submit all of the items in one time? Thank you! aesbovis -- *Anywhere @aesbovis!*
Re: [PHP] Re: ArrayInterator always true
If you enable notices you will see that PHP outputs this : Notice: ArrayIterator::next(): Array was modified outside object and internal position is no longer valid.This line seems to be the problem //Test if next stream is an option for ( $iterator-next(); $iterator-valid(); $iterator-next() ) { . I think that maybe the problem is that you are accessing the array in the second for, PHP detects that when it gets to the first for and it doesn't know if the array is still the same and starts over . Anyway, you are trying to iterate over the array in a pretty strange way :) . My advice is to use $arrayobject-count() to see how many elements you have and then iterate with a for($i=0; $i $arrayobject-count(); $i++) . Also, if you accept only some options than just use getopt function. On Sat, Jan 28, 2012 at 12:10 AM, TCP tgc...@gmail.com wrote: I've got a temporary fix but still the iterator always return true, still hope someone could help me out to point out the problem:) //parseOptions utilitiese by tgckpg function parseOptions ( $argStream, $handler ) { //Chop first useless argument -- argv[0] array_shift ( $argStream ) ; //Initiate ArrayObject for iterator $arrayobject = new ArrayObject ( $argStream ) ; //Initiate iterator for iteration $iterator = $arrayobject-getIterator(); //If options is set first if( $iterator-valid() preg_match ( '/^-\w$/', $iterator-current() ) ) { //iterate through whole argument stream for ( ; $iterator-valid(); $iterator-next() ) { //Check if reached next option if( preg_match ( '/^-\w$/', $opts = $iterator-current() ) ) { //Get current options $currOpt = $opts; //echo $currOpt\n; //Test if next stream is an option for ( $iterator-next(); $iterator-valid(); $iterator-next() ) { if ( preg_match ( '/^-\w$/', $opts = $iterator-current() ) ) { //echo $currOpt $opts\n; $handler($currOpt); $currOpt = $opts; } else break; //var_dump($iterator-valid()); } }//End if //echo $currOpt $opts\n; $handler($currOpt, $opts); //A temporary fix for infinite loop-- if(!$iterator-valid()) break; }// End for //If option is not set first. } else { //Try other approach. }// End if } On Tue, Jan 24, 2012 at 4:18 AM, TCP tgc...@gmail.com wrote: I'm trying to parse an $agrv array that contain options (without square brackets): [-a abc -b bbc bcc -d dbc -e -f] I use ArrayIterator to iterate through the line: - whenever it reach /-\w/, it read through the following qoutes until it reach another /-\w/. The problem is it seems the $iterator-valid() always return TRUE and cause infinte loop. function parseOptions ( $argStream, $handler ) { //Chop first useless argument -- argv[0] array_shift ( $argStream ) ; //Initiate ArrayObject for iterator $arrayobject = new ArrayObject ( $argStream ) ; //Initiate iterator for iteration $iterator = $arrayobject-getIterator(); //If options is set first if( $iterator-valid() preg_match ( '/^-\w$/', $iterator-current() ) ) { //iterate through whole argument stream for ( ; $iterator-valid(); $iterator-next() ) { //Check if reached next option if( preg_match ( '/^-\w$/', $opts = $iterator-current() ) ) { //Get current options $currOpt = $opts; //echo $currOpt\n; //Test if next stream is an option for ($iterator-next(); $iterator-valid(); $iterator-next() ) { if ( preg_match ( '/^-\w$/', $opts = $iterator-current() ) ) { //echo $currOpt $opts\n; //$handler($currOpt, $opts); $currOpt = $opts; } var_dump($iterator-valid()); } }//End if //echo $currOpt $opts\n;
Re: [PHP] reporting errors when $ sign is missing in front of a variable
Also, you get the output my_var because if you say echo my_var PHP looks for a constant my_var and if it doesn't find one it just assumes you want the name of the constant.Look in the manual page for constants for more details about how they work http://php.net/manual/en/language.constants.php On Thu, Jan 12, 2012 at 9:57 AM, ma...@behnke.biz ma...@behnke.biz wrote: Haluk Karamete halukkaram...@gmail.com hat am 12. Januar 2012 um 06:17 geschrieben: Thanks... Well I just changed the ?php error_reporting (E_ALL ^ E_NOTICE); ? to ?php error_reporting (E_ALL ); ? and that does it for me. Notice: Use of undefined constant my_age - assumed 'my_age' in D:\Hosting\5291100\html\blueprint\bp_library.php on line 40 my_age Now back in business :) If you are programming with an IDE, it does the work for you. While programming you will see warning notices, that you are refering to something unknown. -- 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] Question about socket_select
On Wed, Dec 14, 2011 at 1:25 AM, Matijn Woudt tijn...@gmail.com wrote: On Wed, Dec 14, 2011 at 12:11 AM, Mihai Anghel mihaigrim1...@gmail.com wrote: Hello, It appears to me that something is strange with the socket_select function. From what I understand the value of the fourth parameter, tv_sec, should block the execution of the script for that number of seconds. I tried this code : ?php error_reporting(E_ERROR); $serverSocket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); $result = socket_bind($serverSocket, 127.0.0.1, 20668); $start = time(); while(true) { $reads = array($serverSocket); $writes = null; $except = null; $changes = socket_select($reads, $writes, $except, 5); $now = time(); echo $now - $start; echo \n; } and when I run it with php -q server3.php the ouput shows something like 0 0 0 0 0 1 1 1 1 1 2 2 2 2 etc so the script doesn't pause on socket_select until it returns. Cam somebody explain me what's happening ? It seems to me that your socket_select function is failing, maybe because earlier code is failing. Check the return of socket_select like this: if ($changes === false) { echo socket_select() failed, reason: . socket_strerror(socket_last_error()) . \n; } Cheers, Matijn Thanks for your suggestion, I reviewed the code and I saw that I was missing : socket_listen($serverSocket) . After adding this it worked like expected -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Question about socket_select
Hello, It appears to me that something is strange with the socket_select function. From what I understand the value of the fourth parameter, tv_sec, should block the execution of the script for that number of seconds. I tried this code : ?php error_reporting(E_ERROR); $serverSocket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); $result = socket_bind($serverSocket, 127.0.0.1, 20668); $start = time(); while(true) { $reads = array($serverSocket); $writes = null; $except = null; $changes = socket_select($reads, $writes, $except, 5); $now = time(); echo $now - $start; echo \n; } and when I run it with php -q server3.php the ouput shows something like 0 0 0 0 0 1 1 1 1 1 2 2 2 2 etc so the script doesn't pause on socket_select until it returns. Cam somebody explain me what's happening ? Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php