[PHP] " " charactor problem
im trying to build an array from an entry in a file and im having some trouble with it. in a file i have a line similar to: 1234 hello 123456 12345678 I grab this line and try to make it an array like this: $var1 = trim($thelinefromfile); $var2 = split(" ", $thelinefromfile); $count = count($var2); $count comes out to equal 1 so, it doesnt actually see each space as the seperator therefore it sees it as one field.. Ive also tried split("\ ", $thelinefromfile); but, that doesnt work either... ive tried ereg_replace($space, $commathenspace, $thelinefromfile); that also does not seem to work Please help... Thanks in advance Rick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] " " charactor problem
Sean Cazzell wrote: > > I grab this line and try to make it an array like this: > print "line: $thelinefromfile\n"; //Check the line > > $var1 = trim($thelinefromfile); > > $var2 = split(" ", $thelinefromfile); > > $count = count($var2); > > Are you sure $thelinefromfile is actually being set correctly? > > Regards, > > Sean Yes I print it out it says "Array" so i then do print $thelinefromfile[0]; and it prints out the whole line instead of the first field from the line... -- Rick Ridgeway -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Sybase
Can someone give me an example of a simple sybase query page? here is what i have: Here is what I get: Warning: -1 is not a Sybase link index in /www/smurfy/include/clumpysql.php on line 7 Warning: -1 is not a Sybase link index in /www/smurfy/include/clumpysql.php on line 8 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] proc_open problems
Hello, I am using php 4.3.0, and am trying to launch the command line interface for cisco network registrar, and be able to send commands to it and read the output from those commands. Problem I am having is that the commands can take some time to actually respond with output. I can make it work by putting in a sleep after the write/before the read, but i'd like to not have to do that. I have pasted some sample code below (which is basically made up of sample's from the proc_open samples on the php site). Any suggestions would be appreciated. $dspec = array ( 0 => array("pipe", "r"), 1 => array("pipe", "w"), 2 => array("file", "/tmp/ErrorLog.txt", "a"), ); $process = proc_open("$cli", $dspec, $pipes); if (is_resource($process)) { fwrite($pipes[0], $str."\n"); stream_set_blocking($pipes[1], FALSE); while ($ret = fgets($pipes[1], 1024)) { print $ret . "\n"; } } fclose($pipes[0]); fclose($pipes[1]); $return_value=proc_close($process); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php