Re: [PHP] Parsing entities in XML attributes

2004-06-24 Thread Decapode Azur
Hi,

The problem I had has not exactly the same, but quite close,
it was to make a pure xml template system both data and template,
anyway it was due to the same expat design problem, which is
the entities that are located in attribute values inside tags.

The solution I have used was just to preserve expat from parsing entities,
and only need 2 additionnal lines in the script (3 with the constant define;).

Just after the input replace the char '' with something else,
and just before the output put it back :

/** Preserve entities from removal */
define('ENTITY_PRESERVE', '£$¥¤');

[...]

#replacement at input :

while ($data = fread($fp, 4096)) {
$data = str_replace('', ENTITY_PRESERVE, $data);  // HERE
if (!xml_parse($this-_parser, $data, feof($fp))) {
die(sprintf(XML error: %s at ligne %d,
xml_error_string(xml_get_error_code($xml_parser)),
xml_get_current_line_number($xml_parser)));
}
}

[...]

#replacement for output with your code :

function start_tag($parser, $name, $attrs)
{
global $text;
if($name == CUSTOMTEXT) {
$text = $attrs['TEXT'];
$text = str_replace(ENTITY_PRESERVE, '', $text);  // Put '' back !
}
// more tags here ..
}


I am sure that there could be better solutions.
If someone know about one, please email me :)


Cheers
-- 
Gabriel Birke a écrit :
 Hello!

 I've got an XML file that has the following tag:
 customtext text=first linelt;br /gt;second line /

 I parse it with the following handler (simplified a bit):

 function start_tag($parser, $name, $attrs)
 {
   global $text;
   if($name == CUSTOMTEXT)
   $text = $attrs['TEXT'];
   // more tags here ..
 }

 When I echo $text in a HTML page, I see a linebreak - just as I
 intended.

 One of our customers has the script installed on his server and he
 doesn't see a linebreak but sees br / printed out. He has to write
 the tag like this:
 customtext text=first line br /second line /

 Now I've got two questions:
 1. Which tag is correct XML?
 2. What is the cause of this?

 I'm running the script with PHP 4.1.2 and EXPAT Version 1.95.2
 Don't know what our customer has running.

 With best regards

 Gabriel Birke

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] ImageMagick

2004-06-17 Thread Decapode Azur
 Does anyone knows if PHP library for ImageMagick has multilanguage support?
 I am planning to use it but I have not found anything related to this on
 their site

Do you mean for the error messages ?
IMHO the error messages are for the programer, so there is not a real need to 
be multi-language.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Problem with Imagick

2004-06-15 Thread Decapode Azur
Install the devel package of imageMagick in addition to the binary one.
Or install ImageMagick from sources.

Magick-config gives the c and ld flags to gcc, of all the libs that the
lib-magick uses :
gcc `Magick-config --cflags` app.c `Magick-config --ldflags --libs`
http://www.imagemagick.org/www/api.html

-- 
[EMAIL PROTECTED] a écrit :
 I am having a problem installing Imagick in PHP 4.3.6.  In the install
 instructions:

 1) make sure the path to Magick-config (the ImageMagick configuration
script) is in your PATH environment variable

 There is no Magick-config file. Anyone know what ŒMagick-config¹ is
 exactly? I figure this is why the install is failing.

 Thanks!

 /T

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] parsing entities

2004-03-30 Thread Decapode Azur
hello,

I am parsing an xhtml template throught the php xml expat parser.
But the problem is that it removes all entities from the xhtml template
such as nbsp; or amp; (in href anchors attributes)

The entities can't be handle with xml_set_default_handler because some 
entities are inside an attribute (title, href) and are then printed before 
the tag. How can I fix this?

I don't understand how those other functions work:
http://www.php.net/manual/en/function.xml-set-external-entity-ref-handler.php
http://www.php.net/manual/en/function.xml-set-unparsed-entity-decl-handler.php
Could it be the solution?

Another problem is that it changes tags like img / by img/img.
Is there a way to avoid this?


+ Cheers

(PS - I am also curious about how the fuction 
xml_set_start_namespace_decl_handler() work.
Does someone know some informations about?)

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] no highlighted sourcecode in my doc

2004-03-29 Thread Decapode Azur
hello,

I have put the flag --sourcecode on on the phpdoc command line
and the tag @filesource in my page-level docblock

phpDocumentor claims that
'ERROR in my.php on line 12: filesource tag is not available in PHP versions 
less than 4.3.0, tag ignored'
But it does lie: my phpinfo() says my #!/usr/bin/php is 'PHP Version 4.3.1'

I have tried with my other versions:
/usr/bin/phpdoc with #!/usr/local/bin/php434 and #!/usr/local/bin/php435RC4
- Then there is another problem (and still no highlighted sources):
'Creating Directory doc-api/
Warning:  mkdir(doc-api/): Permission denied in 
/usr/share/pear/PhpDocumentor/phpDocumentor/Converter.inc
on line 4585'
- With #!/usr/local/bin/php500b4
'Fatal error/b:  Cannot re-assign $this in 
/usr/share/pear/PhpDocumentor/phpDocumentor/ParserElements.inc on line 238'


What would be the solution to get my highlighted sources?

-- 
cheers

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] file management system

2004-03-11 Thread Decapode Azur
hi all,

I am looking for a file management system.
Does anyone know if such a thing exists?

The goal is to make a web site with computer graphics resources.

The features we would like to find in it would be these if possible:
- the possibility to upload files
- the possibility to check the uploaded file
 (Fileinfo is available on our server)
- the possibility for the uploaders to refer informations and key words on the 
file they upload
- the possibility for the uploaders to introduce themselves in a quick 
description of them and their work
- the possibility for the uploaders to chose the license in which their work 
will be available (copyright or copyleft)
- the possibility for the visitors to browse in the files available
(date, type of file, key words, author, license, popularity of a file, etc..)
- the possibility for the visitors to post reactions and discuss about the 
files, and to rate these.
- we're looking for such a system as Free software (GPL for example)
- if all those feteares are not available in an existing system,
 we will add those, but if such a system do not exist, is there people 
interested in the same features to develop it with us or just helping with 
testing and feedback?



Cheers++

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] modify an XML file

2004-02-01 Thread Decapode Azur
hello!

What is the best solution to modify an XML file?
(Modification such as change the content of a tag or of an attribute)

I think there would be several methods.
What is the best one for small files? (something about 20Ko)
What is the best one for large files? (something about 8Mo)
What should be the weight limit of an XML file which have to be parsed through 
PHP?

-- 
Cheers

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] modify an XML file

2004-02-01 Thread Decapode Azur
 What is the best one for large files? (something about 8Mo)

 Parse with SAX, use printf to produce output.

Ok, it seems this method is defenitly a good one.
I was wondering if it was a good one too, to read the XML file with fgets,
and using ereg fonctions to make the modifications?


-- 
Thanks a lot for your answer.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] colisions writing in a file?

2004-02-01 Thread Decapode Azur
Hello,

Are Problems of colisions with a script writing in a file possible?
For exemple for a PHP script reading a file, and rewriting it with 
modifications, when it is called a lot of times simultaneously, are conflicts 
possible? (over-writing the modifications)
or does each session of this script wait for the previous one to close the 
file before to handle it?

-- 
Thanks

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] stdin from a pipe

2004-01-17 Thread Decapode Azur
hello,
What is the better way to read from a pipe from a php cli script?

#! /usr/bin/php -q
?php
$stdin = fopen('php://stdin', 'r');
while (!feof($stdin))
$buffer .= fgets($stdin, 4096);
fclose($stdin);
?
or
?php
while ($stdin = fread(STDIN, 4096)) $buffer .= $stdin;
?

I have tryed these ways, but the problem is that if there is no pipe input,
the script is waiting for ^D from the user (so this is a problem if the php 
filter is used in a bash script, because it will block the process).

How can I detect if there is an stdin from a pipe or not?

I have tryed this but it does not work:
stream_set_timeout(STDIN, 1, 10);

-- 
thanks

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: deamon / server

2004-01-11 Thread Decapode Azur
  Is it possible to make php scripts working like deamons
  and build something like a server?

 What you trying to achieve...

Well nothing particular, just wondering howto...
For exemple, the script make some calculations, but niced 19 in background 
and/or when the computer is idl. And if sometimes the user want to see where 
the calculations are in progress, the user make a tcp query. Is it possible 
and how?
Or another exemple, a php-gtk 3D isometric game, with a PHP server to put 
several users in the same persistant world. So is it possible (and of course 
how :p) to make a TCP/udp server in PHP ?

Are there (and of course what are their name/url :p) server or deamon writen 
in PHP yet?

-- 
thanks

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] deamon / server

2004-01-09 Thread Decapode Azur
hello,

Is it possible to make php scripts working like deamons
and build something like a server?

-- 
thanks

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Problems with imagick's imagick_readimage

2003-12-09 Thread Decapode Azur
 I was wondering if you any advice as to why the imagick function
 imagick_readimage can not read a url on my php installation.

 Problem: I am trying to get imagick to load an image from a URL. I can
 read from a file on the a file system no problem.

 $url = http://static.php.net/www.php.net/images/php_snow.gif;;
 $handle = imagick_readimage($url) ;  // THIS DOES NOT WORK

 $url = /tmp/foo.gif;
 $handle = imagick_readimage($file) ;  // THIS DOES WORK

 also I can get GD to read from a URL  .eg.
 $url = http://static.php.net/www.php.net/images/php_snow.gif;;
 $src_img=ImageCreateFromGIF($url);


 The problem started after I was forced to change servers due to a disk
 crash. I am using the same versions of the software to build the
 php/mysql/apache.
 Is there any configuration /installation setting that I have missed that
 would stop me from loading the image via the URL ???
 I have tried using GD, but found the image scaling quality to be
 substandard to imagick. I would like to use image magic if possible.

I have made this quick test, to experiment IM loading from url:
display http://static.php.net/www.php.net/images/php_snow.gif
and found a strange behavior, the image is displayed,
but just 3 seconds, then display stops itself.
But loading in local don't bring this behavior..

Probably no relation, but pecl-imagick is still experimental,
perhaps that's just it ?

Well, if you don't find another solution, what you do can (rather than 
writing a tmp img file) is to load all the data image in a php var, and then 
throw it to pecl-imagick with the imagick_blob2image() function...
This solution works, I'm using it to link php-gtk with php-imagick
without tmp img files. Moreover as you can see below, this is shown in the 
exemples given in the imagick package:
http://grincheux.codelutin.org/~monnier/doc/imagick/blob2image.php

 Has anyone had similar problems?

Me, my problem with pecl-imagick is that not all the ImageMagick fonctions I 
am used to are available. And some of the non-available fonctions are very 
important like mask, disolve, some others not very important but rather very 
useful like round edge rectangles, bezier curves, etc...
Well, there is still a lot of work to do to bring pcel-imagick to the same 
high level than Perl-imageMagick ... :,(

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] install php-cli script

2003-11-20 Thread Decapode Azur
hello,
Where should php-cli scripts be installed?
I have put the main file in /usr/local/bin/script.php
but I wonder where requires should be installed?
/usr/local/bin/script_inc/  ?
the problem is that it have to be exec from a boot shell after a cd
to find the requisites :-/

I also would like to know how to make the equivalent for windows users?


++

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] diff

2003-11-18 Thread Decapode Azur
hello

Is there a php function close to the *nix diff comand?
(in order to compare 2 multi-lines strings)

thanx

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] where to set session.bug_compat_warn ?

2003-10-26 Thread Decapode Azur
hi, I have the warning message below.
In which conf file can I set session.bug_compat_42 or 
session.bug_compat_warn to off?
And where can I find this conf file?

(annexe question: Is it possible to get the warnings in a variable so I 
could print it in html comment, or write it in a log file?)

thanks
-- 
Warning: Unknown(): Your script possibly relies on a session side-effect 
which existed until PHP 4.2.3. Please be advised that the session extension 
does not consider global variables as a source of data, unless 
register_globals is enabled. You can disable this functionality and this 
warning by setting session.bug_compat_42 or session.bug_compat_warn to off, 
respectively.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] uncompressing gz string

2003-10-24 Thread Decapode Azur
I don't understand why gzinflate and gzuncompress don't work?

?php
$gz_content = file_get_contents('hello.txt.gz');

echo gzinflate($gz_content);
// Warning: data error

echo gzuncompress($gz_content);
// Warning: data error
?

but if I make it from bash the content is there :
cat hello.txt.gz | gunzip
Hello!

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] [cli] ^D

2003-10-21 Thread Decapode Azur
  Is there a way, for a cli script, to detect Ctrl_D or Ctrl_Z ?
[...]
 Take a look at pcntl functions, namely pcntl_signal.
 But this extension is not enabled by default.

Ok thanks a lot.

Will those functions be integrated in the next main release?
This question is just to know if I distribute such a php script,
will allways the users have to recompile PHP to use it?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] [cli] ^D

2003-10-20 Thread Decapode Azur
hi all,

Is there a way, for a cli script, to detect Ctrl_D or Ctrl_Z ?
My cli php script runs a loop while(1) and I would like to find a way to 
stop it from a user action.
(Waiting a better solution I've made:  if(file_exists('./stop'))
and type the command stop to stop the script.
I can not use readline cause this would break the loop.)

thanks

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] [xml] character data

2003-10-10 Thread Decapode Azur
I do not understand why this line does not work :
$info[$element] = $content;

but yet this works: echo $content;

why? what is the trick?

-- 

$xml_comment_file = basename($svg_file, '.svg.xml') .'.info.xml';

if (file_exists($xml_comment_file)) {
$file = $xml_comment_file;

$info = array();
$element = null;

function startElement($parser, $name, $attrs) {
global $element;
$element = $name;
}
function endElement($parser, $name) {
print ;
}
function characterData($parser, $content) {
global $info;
global $element;
$info[$element] = $content;
//$info[$element] = sprintf(%s, $content);
}

$xml_parser = xml_parser_create();
xml_parser_set_option($xml_parser, XML_OPTION_CASE_FOLDING, FALSE);
xml_set_element_handler($xml_parser, startElement, endElement);
xml_set_character_data_handler($xml_parser, characterData);

if (!($fp = fopen($file, 'r')))
die(could not open XML input\n);

while ($data = fread($fp, 4096))
if (!xml_parse($xml_parser, $data, feof($fp)))
die(sprintf(XML error: %s at line %d,
   xml_error_string(xml_get_error_code($xml_parser)),
   xml_get_current_line_number($xml_parser)));

xml_parser_free($xml_parser);

print_r($info);
}
/*
# the output is without $content :
Array
(
[info] =
[file] =
[orig-file] =
[orig-author] =
[bitmap-src] =
[orig-date] =
[svg-date] =

)
*/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Resource Limits

2003-09-27 Thread Decapode Azur
hi the list,

How can I get the values of 'max_execution_time', 'max_input_time' and 
'memory_limit' from my php script ?


thanks

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] [resource] memory size

2003-09-27 Thread Decapode Azur
Hi, is it possible to get, from a php script, the memory size it takes ?

Is there documentations explaining how to manage resources in php ?

thanks

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] present php code with css

2003-09-24 Thread Decapode Azur

For people interested in presenting php code on their web site and 
integrate it with their css, here is a small sed script I have made.

Just change the colors in it, or move it to your css.

===
# Put php sources in SRC dir, or change FROM definition.
FROM=SRC
DEST=listing

if [ ! -d $DEST ]; then
mkdir $DEST
fi

for p in `ls $FROM/*.php` ; do php -s $p | sed  \
-e s|br /|\n|g  \
-e s|font color=\|span class=\|g  \
-e s|/font|/span|g\
-e s|nbsp;| |g   \
-e s|lt;?br /|\lt;?phpbr /|g\
-e s|code|html\nhead\ntitle`basename $p .php`/title\n\
style type='text/css'\n\
@import \./styles/01.css\;\n\
pre {   background: #EEE; }\n\
.string {   color: #D00; }\n\
.comment {  color: #F90; }\n\
.keyword {  color: #070; }\n\
.default {  color: #00B; }\n\
.html { color: #000; }\n/style\
\n/head\nbody\n\npre|g   \
-e s|/code|/pre\n\n/body\n/html|g \
 $DEST/`basename $p .php`.html ; done
===

And change this at Colors for Syntax Highlighting section
in the php.ini :
highlight.string  = string
highlight.comment = comment
highlight.keyword = keyword
highlight.bg  = bg
highlight.default = default
highlight.html= html 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] XHTML / CSS

2003-09-22 Thread Decapode Azur
First, excuse-me for this out of topic message.

I am searching a good mailling-list for people trying to write standard 
XHTML and CSS.



thanks

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: [imagick] converting to variable instead of file

2003-09-07 Thread Decapode Azur
finaly I did it this way : (pasted at the end of the mail)

But the problem is the result is very dirty,
considering the result with other way to do this.

top-left is the image in XPM-format
top-right is the image in PNG-format
bottom-left is a classic php-gtk-script displaying an XPM image
bottom-right is the php-script below loading and displaying a PNG img

Why is the result so bad ?

===
?php
if ( !extension_loaded( 'gtk' ) )
strstr( PHP_OS, 'Linux' ) ? dl('php_gtk.so') : dl('php_gtk.dll');

$handle = imagick_readimage( 'images/img.1.png' );
if ( imagick_iserror( $handle ) ) {
$reason  = imagick_failedreason( $handle );
$description = imagick_faileddescription( $handle );
print handle failed!\nReason: $reason\nDescription: 
$description\n;
exit;
}
imagick_convert( $handle, 'XPM' );
if ( !( $image_data  = imagick_image2blob( $handle ) ) ) {
$reason  = imagick_failedreason( $handle );
$description = imagick_faileddescription( $handle );
print imagick_image2blob() failed\nReason: $reason\nDescription: 
$description\n;
exit;
}

$head = '!/\*\s*XPM\s*\*/\s*static\s*char\s*\*\[\]\s*=\s*{\s*/\*\s*columns 
rows colors chars-per-pixel\s*\*/\s*!';
$image_data = preg_replace( $head, '', $image_data );
$image_data = preg_replace( '!/\*\s*pixels\s*\*/\s*!m', '', $image_data );
$image_data = preg_replace( '!\s*};\s*$!', '', $image_data );
$image_data = preg_replace( '!(^|,$)!m', '', $image_data );

$image_data = explode( \n, $image_data );

$win = new GtkWindow();
$win-connect( 'destroy', create_function( '', 'Gtk::main_quit();' ) );
$win-set_usize( 256, 256 );
$win-realize();

$transp = new GdkColor( 1, 0, 0 );
list( $pixmap, $mask ) = Gdk::pixmap_create_from_xpm_d( $win-window, 
$transp, $image_data );
$image = new GtkPixmap( $pixmap, $mask );

$box = new GtkVbox();
$box-add( $image );
$win-add( $box );
$win-show_all();

Gtk::main();

?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] [imagick] converting to variable instead of file

2003-09-06 Thread Decapode Azur

I had thought too that it is possible to write a temp file for this image,
but it would be much better i think if there was another way...

Is it really impossible to prevent from this hard disk access ?

-- 
 Write it to a tem file then use file_get_contents() on the file name.

[...]
 With imagick_writeimage() function, is it possible to send the image to
  a variable instead of dumping it to a file or to the client browser?
 
 Thanks
 PS (if I try this, it is to convert an image to xpm in a variable and
  use it in php-gtk)

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Question regarding OOP and interitance

2003-09-04 Thread Decapode Azur

 FYI ... anything below PHP5 has a pseudo constructor.

And how will it be in PHP5 ?


 Since you are inheriting the class the 'constructor' for the parent class
 should work. If it doesn't (I have not tested it, and neither have
 you)then the class extension can contain a 'contstructor' that is a
 duplicate of the parent class 'constructor' but with the extension name.
 You'll have to test it to make sure.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] in the middle of shift and pop

2003-08-20 Thread Decapode Azur
 If you unset an array that isn't associative, will that mean there will
 be a gap in the numbers?

Yes the items are grabed by their index.
I'm using those arrays to manipulate 3D geometric shapes,
(either vrml/x3d, OpenGL, POV and other ones**)
so cartesian coordinates are first referenced in a first array,
and then faces (facets?) are build giving the index of 3 (or more) points,
so the index need to be the good one and not on a null or the next value.

 Or will PHP realize OK I need to change the numbers indexing the other
 elements?

** as PHP is a high level language I can write very quickly and very easily 
scripts to make manipulations on my 3D meshes, but the problem is that it 
often takes more than an hour to execute, so I realy need to learn about 
writing efficient code and optimizing PHP...

[snip]--8---

 I'm compelled to ask *why* you want that result.  In most cases it makes
 no difference to your coding, so the only real reason I can see is a
 somewhat obsessive desire for neatness!

Perhaps there is a better way to grab the good points to build the faces,
but I did not find another solution yet.
If you know about another better issue to resolve this problem, please let 
me know about it.



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Code formatting issue

2003-08-19 Thread Decapode Azur

this way may be what you'd like :

  $thing = new whatever ();

  $with = array (doStuff', anotherThing', doThis', doThat', doThis',
doThat', anotherThing', doThis', /* etc. etc. */ );

  foreach($with as $w) $thing-$w();


-- 
 Is there a way I can make this type of code neater?

  $thing = new whatever ();

  $thing-doStuff ();
  $thing-anotherThing ();
  $thing-doThis ();
  $thing-doThat ();
  $thing-doThis ();
  $thing-doThat ();
  $thing-anotherThing ();
  $thing-doThis ();
  // etc. etc.


 Some languages have the construct with, so you can so something like
 this:

  $thing = new whatever ();

  with ( $thing ) {

   doStuff ();
   anotherThing ();
   doThis ();
   doThat ();
   doThis ();
   doThat ();
   anotherThing ();
   doThis ();
  // etc. etc.
  }

 which is much neater. Is there anyway to do this type of thing with PHP?


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] in the middle of shift and pop

2003-08-19 Thread Decapode Azur
is it possible to remove an element of an indexed array such as this exemple
$A = array('a', 'b', 'c', 'd', 'e', 'f');
in a way that we can optain this result :
$A = array('a', 'b', 'd', 'e', 'f');

something like that perhaps ?
array_remove($A, 2);

If such a function does not exists, what would be the more efficient way to 
do so a lot of time on very big arrays ?



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] in the middle of shift and pop

2003-08-19 Thread Decapode Azur
 is it possible to remove an element of an indexed array such as this
 exemple $A = array('a', 'b', 'c', 'd', 'e', 'f');
 in a way that we can optain this result :
   $A = array('a', 'b', 'd', 'e', 'f');

 something like that perhaps ?
 array_remove($A, 2);

 If such a function does not exists, what would be the more efficient way
 to do so a lot of time on very big arrays ?

perhaps this way :

?php
function array_remove($array, $remove) {
foreach ($remove as $rem)   unset($array[$rem]);
foreach($array as $a)   $rem_array[] = $a;
return $rem_array;
}

$array  = array('A','B','C','D','E','F','G','H','I','J');
$remove = array(2, 5, 7);

print_r($array);
$rem_array = array_remove($array, $remove);
print_r($rem_array);
?


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] in the middle of shift and pop

2003-08-19 Thread Decapode Azur
 unset($A[2]);

No this function does not exactly what I want.
unset() makes empty hole with $A[2] = Null

I would like to have this result :
Array
(
[0] = a
[1] = b
[2] = d
[3] = e
[4] = f
)
and not this one :
Array
(
[0] = a
[1] = b
[3] = d
[4] = e
[5] = f
)


 is it possible to remove an element of an indexed array such as this
 exemple
  $A = array('a', 'b', 'c', 'd', 'e', 'f');
 in a way that we can optain this result :
  $A = array('a', 'b', 'd', 'e', 'f');

 something like that perhaps ?
 array_remove($A, 2);

 If such a function does not exists, what would be the more efficient way
 to do so a lot of time on very big arrays ?



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] gzip to max 9

2003-08-10 Thread Decapode Azur

 try setting zlib.output_compression_level in your php.ini

won't it turn  'zlib.output_compression'  to On ?
(because I prefere to keep it Off)


-- 
  ?php
  function wrl2wrz($buffer) { return gzencode ($buffer, 9); }
  ob_start(wrl2wrz);
  /* here the file */
  ob_end_flush(); # end of the output buffering
  ?
 
  In this exemple with output beffering it is possible to select the
  maximum compression level,
 
  is it possible to select the maximum compression level too
  when writing in a file like below ??
 
  $gzp = fopen($output_file, 'w');
  gzwrite($gzp, $content);
  gzclose($gzp);
 
  I think that the default compression level here is 6,
  and I would like to bring it to the maximum value 9.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] gzip to max 9

2003-08-09 Thread Decapode Azur
Dear All,


?php
function wrl2wrz($buffer) { return gzencode ($buffer, 9); }
ob_start(wrl2wrz);

/* here the file */

ob_end_flush(); # end of the output buffering
?

In this exemple with output beffering it is possible to select the maximum 
compression level,

is it possible to select the maximum compression level too
when writing in a file like below ??

$gzp = fopen($output_file, 'w');
gzwrite($gzp, $content);
gzclose($gzp);


I think that the default compression level here is 6,
and I would like to bring it to the maximum value 9.

-- 
cheers


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP or CGI in C/C++

2003-08-01 Thread Decapode Azur
 I would expect compiled C/C++ to be faster as there is no need for
 the code to be interperated and compiled on each request.


Is it possible to compile PHP to improve the speed execution ?



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] eval

2003-08-01 Thread Decapode Azur

Is it possible to put PHP code in eval ?
Or just vars ?


?php

$string = 'The result of ?php $a=2; $b=3; $c=$a+$b; echo $a + $b is $c; 
?';

eval ($string);

?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] install php-gtk on mdk9.1

2003-07-30 Thread Decapode Azur

I am trying to install PHP-GTK

here is below the error :


[EMAIL PROTECTED] php-gtk-0.5.2]$ ./buildconf
[EMAIL PROTECTED] php-gtk-0.5.2]$ ./configure
[EMAIL PROTECTED] php-gtk-0.5.2]$ make
[]
/PHP_GTK/php-gtk-0.5.2/main/php_gtk_object.c:889: `gtk_object_ce' undeclared 
(first use in this function)
make: *** [main/php_gtk_object.lo] Erreur 1

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php