[PHP] $POST and $_SESSION

2012-03-15 Thread Tedd Sperling
Hi gang: What's a better/shorter way to write this? $first_name = $_SESSION['first_name'] ? $_SESSION['first_name'] : null; $first_name = isset($_POST['first_name']) ? $_POST['first_name'] : $first_name; $_SESSION['first_name'] = $first_name; Cheers, tedd _

Re: [PHP] $POST and $_SESSION

2012-03-15 Thread Daniel Brown
On Thu, Mar 15, 2012 at 11:04, Tedd Sperling tedd.sperl...@gmail.com wrote: Hi gang: What's a better/shorter way to write this? $first_name = $_SESSION['first_name'] ? $_SESSION['first_name'] : null; $first_name = isset($_POST['first_name']) ? $_POST['first_name'] : $first_name;

[PHP] Variables are empty only in fwrite

2012-03-15 Thread Larry
Hello, when I pass a variable whose value originally came from $_GET or $_REQUEST to fwrite, fwrite behaves as if it was passed an empty string. Note that the file is successfully opened and written to by the script, but the variable that originally came from $_GET does not have its value

[PHP] i hope using set_exception_handler and set_error_handler in php extension code.

2012-03-15 Thread langwan
i hope using set_exception_handler and set_error_handler in php extension code. hi, all: i write php monitor extension now. 1. question i hope using set_exception_handler or set_error_handler in PHP_RINIT_FUNCTION() for example: PHP_RINIT_FUNCTION(my) {

Re: [PHP] $POST and $_SESSION

2012-03-15 Thread Michael Save
How about this? $first_name = @$_POST['first_name'] or $first_name = $_SESSION['first_name'] ? $_SESSION['first_name'] : null; Thanks, Michael On Fri, Mar 16, 2012 at 2:13 AM, Daniel Brown danbr...@php.net wrote: On Thu, Mar 15, 2012 at 11:04, Tedd Sperling tedd.sperl...@gmail.com wrote: Hi

Re: [PHP] Variables are empty only in fwrite

2012-03-15 Thread Daniel P. Brown
On Thu, Mar 15, 2012 at 11:30, Larry lrr...@gmail.com wrote: Hello, when I pass a variable whose value originally came from $_GET or $_REQUEST to fwrite, fwrite behaves as if it was passed an empty string. Note that the file is successfully opened and written to by the script, but the variable

Re: [PHP] Variables are empty only in fwrite

2012-03-15 Thread Larry
On Thu, Mar 15, 2012 at 11:53 AM, Daniel P. Brown daniel.br...@parasane.net wrote: On Thu, Mar 15, 2012 at 11:30, Larry lrr...@gmail.com wrote: Hello, when I pass a variable whose value originally came from $_GET or $_REQUEST to fwrite, fwrite behaves as if it was passed an empty string. Note

Re: [PHP] class method visibility

2012-03-15 Thread Matijn Woudt
2012/3/15 Jeremy Wei shuimuqing...@gmail.com: I read the manual about  method visibility, but i can't understand the code below: ?php class Bar {    public function test() {        $this-testPrivate();        $this-testPublic();    }    public function testPublic() {        echo

[PHP] Re: $POST and $_SESSION

2012-03-15 Thread Michael Clark
On 3/15/2012 9:04 AM, Tedd Sperling wrote: What's a better/shorter way to write this? $first_name = $_SESSION['first_name'] ? $_SESSION['first_name'] : null; $first_name = isset($_POST['first_name']) ? $_POST['first_name'] : $first_name; $_SESSION['first_name'] = $first_name; Better:

Re: [PHP] Variables are empty only in fwrite

2012-03-15 Thread Matijn Woudt
On Thu, Mar 15, 2012 at 4:59 PM, Larry lrr...@gmail.com wrote: On Thu, Mar 15, 2012 at 11:53 AM, Daniel P. Brown daniel.br...@parasane.net wrote: On Thu, Mar 15, 2012 at 11:30, Larry lrr...@gmail.com wrote: Hello, when I pass a variable whose value originally came from $_GET or $_REQUEST to

Re: [PHP] Re: $POST and $_SESSION

2012-03-15 Thread Matijn Woudt
On Thu, Mar 15, 2012 at 5:25 PM, Michael Clark mcl...@insidesales.com wrote: On 3/15/2012 9:04 AM, Tedd Sperling wrote: What's a better/shorter way to write this? $first_name = $_SESSION['first_name'] ? $_SESSION['first_name'] : null; $first_name = isset($_POST['first_name']) ?

[PHP] fgetcsv doesn't return an array?

2012-03-15 Thread Jay Blanchard
I thought that fgetcsv returned an array. I can work with it like an array but I get the following warning when using it |Warning: implode(): Invalid arguments passed on line 155 154 $csvCurrentLine = fgetcsv($csvFile, 4096, ','); 155 $currentLine = implode(,, $csvCurrentLine); |

Re: [PHP] fgetcsv doesn't return an array?

2012-03-15 Thread Matijn Woudt
On Thu, Mar 15, 2012 at 6:09 PM, Jay Blanchard jay.blanch...@sigmaphinothing.org wrote: I thought that fgetcsv returned an array. I can work with it like an array but I get the following warning when using it |Warning:  implode(): Invalid arguments passed on line 155 154     $csvCurrentLine

Re: [PHP] fgetcsv doesn't return an array?

2012-03-15 Thread Jay Blanchard
On 3/15/2012 12:23 PM, Matijn Woudt wrote: On Thu, Mar 15, 2012 at 6:09 PM, Jay Blanchard jay.blanch...@sigmaphinothing.org wrote: I thought that fgetcsv returned an array. I can work with it like an array but I get the following warning when using it |Warning: implode(): Invalid arguments

Re: [PHP] fgetcsv doesn't return an array?

2012-03-15 Thread Jim Lucas
On 03/15/2012 10:09 AM, Jay Blanchard wrote: I thought that fgetcsv returned an array. I can work with it like an array but I get the following warning when using it |Warning: implode(): Invalid arguments passed on line 155 154 $csvCurrentLine = fgetcsv($csvFile, 4096, ','); 155 $currentLine =

Re: [PHP] fgetcsv doesn't return an array?

2012-03-15 Thread Andrew Ballard
On Thu, Mar 15, 2012 at 1:29 PM, Jay Blanchard jay.blanch...@sigmaphinothing.org wrote: On 3/15/2012 12:23 PM, Matijn Woudt wrote: On Thu, Mar 15, 2012 at 6:09 PM, Jay Blanchard jay.blanch...@sigmaphinothing.org  wrote: I thought that fgetcsv returned an array. I can work with it like an

Re: [PHP] fgetcsv doesn't return an array?

2012-03-15 Thread Lester Caine
Jay Blanchard wrote: 154 $csvCurrentLine = fgetcsv($csvFile, 4096, ','); 155 $currentLine = implode(,, $csvCurrentLine); I am using it in a loop. End Of File is an error? You certainly need to break out on $csvCurrentLine = false which indicates end of file at least. My own

Re: [PHP] fgetcsv doesn't return an array?

2012-03-15 Thread Matijn Woudt
On Thu, Mar 15, 2012 at 6:40 PM, Andrew Ballard aball...@gmail.com wrote: On Thu, Mar 15, 2012 at 1:29 PM, Jay Blanchard jay.blanch...@sigmaphinothing.org wrote: On 3/15/2012 12:23 PM, Matijn Woudt wrote: On Thu, Mar 15, 2012 at 6:09 PM, Jay Blanchard jay.blanch...@sigmaphinothing.org  

Re: [PHP] $POST and $_SESSION

2012-03-15 Thread Stuart Dallas
On 15 Mar 2012, at 15:13, Daniel Brown wrote: On Thu, Mar 15, 2012 at 11:04, Tedd Sperling tedd.sperl...@gmail.com wrote: Hi gang: What's a better/shorter way to write this? $first_name = $_SESSION['first_name'] ? $_SESSION['first_name'] : null; $first_name = isset($_POST['first_name'])

Re: [PHP] $POST and $_SESSION

2012-03-15 Thread Stuart Dallas
On 15 Mar 2012, at 18:31, Stuart Dallas wrote: On 15 Mar 2012, at 15:13, Daniel Brown wrote: On Thu, Mar 15, 2012 at 11:04, Tedd Sperling tedd.sperl...@gmail.com wrote: Hi gang: What's a better/shorter way to write this? $first_name = $_SESSION['first_name'] ? $_SESSION['first_name'] :

Re: [PHP] $POST and $_SESSION

2012-03-15 Thread Daniel Brown
On Thu, Mar 15, 2012 at 14:31, Stuart Dallas stu...@3ft9.com wrote: The @ prefix is banned from all code I go anywhere near - it's evil! I've used the following 'V' function for a long time, primarily for accessing the superglobals but it works for any array. ?php session_start();

Re: [PHP] $POST and $_SESSION

2012-03-15 Thread Stuart Dallas
On 15 Mar 2012, at 18:35, Daniel Brown wrote: On Thu, Mar 15, 2012 at 14:31, Stuart Dallas stu...@3ft9.com wrote: The @ prefix is banned from all code I go anywhere near - it's evil! I've used the following 'V' function for a long time, primarily for accessing the superglobals but it

Re: [PHP] $POST and $_SESSION

2012-03-15 Thread sono-io
On Mar 15, 2012, at 11:35 AM, Daniel Brown wrote: On Thu, Mar 15, 2012 at 14:31, Stuart Dallas stu...@3ft9.com wrote: The @ prefix is banned from all code I go anywhere near - it's evil! For the most part, I agree with you, Hmm... I use it on my web pages (unless I'm testing)

Re: [PHP] Variables are empty only in fwrite

2012-03-15 Thread Larry
On Thu, Mar 15, 2012 at 12:21 PM, Matijn Woudt tijn...@gmail.com wrote: On Thu, Mar 15, 2012 at 4:59 PM, Larry lrr...@gmail.com wrote: On Thu, Mar 15, 2012 at 11:53 AM, Daniel P. Brown daniel.br...@parasane.net wrote: On Thu, Mar 15, 2012 at 11:30, Larry lrr...@gmail.com wrote: Hello, when I

Re: [PHP] $POST and $_SESSION

2012-03-15 Thread Stuart Dallas
On 15 Mar 2012, at 18:48, sono...@fannullone.us wrote: On Mar 15, 2012, at 11:35 AM, Daniel Brown wrote: On Thu, Mar 15, 2012 at 14:31, Stuart Dallas stu...@3ft9.com wrote: The @ prefix is banned from all code I go anywhere near - it's evil! For the most part, I agree with you,

Re: [PHP] Variables are empty only in fwrite

2012-03-15 Thread Matijn Woudt
On Thu, Mar 15, 2012 at 7:51 PM, Larry lrr...@gmail.com wrote: On Thu, Mar 15, 2012 at 12:21 PM, Matijn Woudt tijn...@gmail.com wrote: On Thu, Mar 15, 2012 at 4:59 PM, Larry lrr...@gmail.com wrote: On Thu, Mar 15, 2012 at 11:53 AM, Daniel P. Brown daniel.br...@parasane.net wrote: On Thu, Mar

Re: [PHP] $POST and $_SESSION

2012-03-15 Thread Ashley Sheridan
On Thu, 2012-03-15 at 18:52 +, Stuart Dallas wrote: On 15 Mar 2012, at 18:48, sono...@fannullone.us wrote: On Mar 15, 2012, at 11:35 AM, Daniel Brown wrote: On Thu, Mar 15, 2012 at 14:31, Stuart Dallas stu...@3ft9.com wrote: The @ prefix is banned from all code I go anywhere

Re: [PHP] $POST and $_SESSION

2012-03-15 Thread Adam Richardson
On Thu, Mar 15, 2012 at 11:04 AM, Tedd Sperling tedd.sperl...@gmail.com wrote: Hi gang: What's a better/shorter way to write this? $first_name = $_SESSION['first_name'] ? $_SESSION['first_name'] : null; $first_name = isset($_POST['first_name']) ? $_POST['first_name'] : $first_name;

Re: [PHP] Variables are empty only in fwrite

2012-03-15 Thread Larry
On Thu, Mar 15, 2012 at 2:57 PM, Matijn Woudt tijn...@gmail.com wrote: On Thu, Mar 15, 2012 at 7:51 PM, Larry lrr...@gmail.com wrote: On Thu, Mar 15, 2012 at 12:21 PM, Matijn Woudt tijn...@gmail.com wrote: On Thu, Mar 15, 2012 at 4:59 PM, Larry lrr...@gmail.com wrote: On Thu, Mar 15, 2012 at

Re: [PHP] Variables are empty only in fwrite

2012-03-15 Thread Matijn Woudt
On Thu, Mar 15, 2012 at 8:41 PM, Larry lrr...@gmail.com wrote: On Thu, Mar 15, 2012 at 2:57 PM, Matijn Woudt tijn...@gmail.com wrote: On Thu, Mar 15, 2012 at 7:51 PM, Larry lrr...@gmail.com wrote: On Thu, Mar 15, 2012 at 12:21 PM, Matijn Woudt tijn...@gmail.com wrote: On Thu, Mar 15, 2012 at

Re: [PHP] Variables are empty only in fwrite

2012-03-15 Thread Larry
On Thu, Mar 15, 2012 at 4:03 PM, Matijn Woudt tijn...@gmail.com wrote: On Thu, Mar 15, 2012 at 8:41 PM, Larry lrr...@gmail.com wrote: On Thu, Mar 15, 2012 at 2:57 PM, Matijn Woudt tijn...@gmail.com wrote: On Thu, Mar 15, 2012 at 7:51 PM, Larry lrr...@gmail.com wrote: On Thu, Mar 15, 2012 at

[PHP] Any SNMP Guru's?

2012-03-15 Thread David OBrien
Using command line snmpget you can set an option to append leading 0's to hex values -o0 So instead of $macaddress = 0:1a:4b:c:8d:fb; it would be $macaddress = 00:1a:4b:0c:8d:fb; is there any option using the extremely well documented php snmp extension to do the same?

Re: [PHP] Variables are empty only in fwrite

2012-03-15 Thread Stuart Dallas
On 15 Mar 2012, at 20:07, Larry wrote: On Thu, Mar 15, 2012 at 4:03 PM, Matijn Woudt tijn...@gmail.com wrote: On Thu, Mar 15, 2012 at 8:41 PM, Larry lrr...@gmail.com wrote: On Thu, Mar 15, 2012 at 2:57 PM, Matijn Woudt tijn...@gmail.com wrote: On Thu, Mar 15, 2012 at 7:51 PM, Larry

Re: [PHP] fgetcsv doesn't return an array?

2012-03-15 Thread Jay Blanchard
[snip] Please, don't do that. Use this instead: while (($csvCurrentLine = fgetcsv($csvFile, 4096, ',')) !== FALSE) { } [/snip] Not sure why, but ok. Thanks everyone! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] fgetcsv doesn't return an array?

2012-03-15 Thread Stuart Dallas
On 15 Mar 2012, at 20:26, Jay Blanchard wrote: [snip] Please, don't do that. Use this instead: while (($csvCurrentLine = fgetcsv($csvFile, 4096, ',')) !== FALSE) { } [/snip] Not sure why, but ok. Thanks everyone! An empty line would lead to $csvCurrentLine == array() which as a boolean

Re: [PHP] Any SNMP Guru's?

2012-03-15 Thread Mike Mackintosh
I don't not think there is a way without patching snmp.c prior to PHP configuring. You can always do: $segment = explode(:, $macaddress); foreach($segment as $seg){ $hex[] = str_pad($seg, 2, 0, STR_PAD_LEFT); } $macaddress = implode(:, $hex); or use a preg replace function and match