├── COPYING ├── CREATING_DISTRIBUTION ├── LICENSE ├── Makefile.am ├── NEWS ├── README ├── SConstruct ├── bootstrap.sh ├── configure.ac ├── docs ├── phpembed.pdf ├── phpembed.tex └── www │ ├── footnode.html │ ├── image.png │ ├── index.html │ ├── internals.pl │ ├── labels.pl │ ├── node1.html │ ├── node10.html │ ├── node100.html │ ├── node101.html │ ├── node102.html │ ├── node103.html │ ├── node104.html │ ├── node105.html │ ├── node11.html │ ├── node12.html │ ├── node13.html │ ├── node14.html │ ├── node15.html │ ├── node16.html │ ├── node162.html │ ├── node17.html │ ├── node18.html │ ├── node19.html │ ├── node2.html │ ├── node20.html │ ├── node21.html │ ├── node22.html │ ├── node23.html │ ├── node24.html │ ├── node25.html │ ├── node26.html │ ├── node27.html │ ├── node28.html │ ├── node29.html │ ├── node3.html │ ├── node30.html │ ├── node31.html │ ├── node32.html │ ├── node33.html │ ├── node34.html │ ├── node35.html │ ├── node36.html │ ├── node37.html │ ├── node38.html │ ├── node39.html │ ├── node4.html │ ├── node40.html │ ├── node41.html │ ├── node42.html │ ├── node43.html │ ├── node44.html │ ├── node45.html │ ├── node46.html │ ├── node47.html │ ├── node48.html │ ├── node49.html │ ├── node5.html │ ├── node50.html │ ├── node51.html │ ├── node52.html │ ├── node53.html │ ├── node54.html │ ├── node55.html │ ├── node56.html │ ├── node57.html │ ├── node58.html │ ├── node59.html │ ├── node6.html │ ├── node60.html │ ├── node61.html │ ├── node62.html │ ├── node63.html │ ├── node64.html │ ├── node65.html │ ├── node66.html │ ├── node67.html │ ├── node68.html │ ├── node69.html │ ├── node7.html │ ├── node70.html │ ├── node71.html │ ├── node72.html │ ├── node73.html │ ├── node74.html │ ├── node75.html │ ├── node76.html │ ├── node77.html │ ├── node78.html │ ├── node79.html │ ├── node8.html │ ├── node80.html │ ├── node81.html │ ├── node82.html │ ├── node83.html │ ├── node84.html │ ├── node85.html │ ├── node86.html │ ├── node87.html │ ├── node88.html │ ├── node89.html │ ├── node9.html │ ├── node90.html │ ├── node91.html │ ├── node92.html │ ├── node93.html │ ├── node94.html │ ├── node95.html │ ├── node96.html │ ├── node98.html │ ├── node99.html │ ├── phpembed.css │ └── phpembed.html ├── examples ├── Makefile.am ├── example.cpp ├── example.php ├── test.cpp ├── test.php └── usage.cpp ├── phpembedVersion.h.in └── src ├── Makefile.am ├── php_arr.cpp ├── php_arr.h ├── php_cxx.cpp ├── php_cxx.h ├── php_stl.cpp ├── php_stl.h ├── php_tok.cpp ├── php_tok.h └── php_tok_consts.h /COPYING: -------------------------------------------------------------------------------- 1 | THE PHPEMBED LICENSE AGREEMENT 2 | 3 | Copyright (c) 2007, Andrew Bosworth, Facebook, inc. 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are met: 8 | 9 | * Redistributions of source code must retain the above copyright notice, 10 | this list of conditions and the following disclaimer. 11 | * Redistributions in binary form must reproduce the above copyright 12 | notice, this list of conditions and the following disclaimer in the 13 | documentation and/or other materials provided with the distribution. 14 | * Neither the name of Facebook, inc. nor the names of its contributors may 15 | be used to endorse or promote products derived from this software without 16 | specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE 22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /CREATING_DISTRIBUTION: -------------------------------------------------------------------------------- 1 | 2 | Checkout phpembed/trunk 3 | +++++++++++++++++++++++ 4 | 5 | (1) Update configure.ac. Change AM_INIT_AUTOMAKE version number. Commit. 6 | 7 | (2) ./bootstrap.sh; ./configure; 8 | 9 | (3) Run "make dist" 10 | // creates a "phpembed-x.y.z.tar.gz" file 11 | 12 | (4) Extract contents of tar gzip file. Remove all files / dirs except 13 | bootstrap.sh configure.ac COPYING docs examples LICENSE Makefile.am NEWS phpembedVersion.h.in README SConstruct src 14 | 15 | /rm aclocal.m4 AUTHORS ChangeLog config.guess config.h.in config.sub configure depcomp install-sh ltmain.sh missing INSTALL Makefile.in 16 | 17 | (5) Re tar / gzip into a new file named "phpembed-.tar.gz 18 | 19 | (6) Verify content of tar file. Try a build etc. 20 | 21 | (7) Check into svn+ssh://tubbs/svnroot/projects/phpembed 22 | 23 | (8) Hand over to Boz / Shire to opensource. 24 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | THE PHPEMBED LICENSE AGREEMENT 2 | 3 | Copyright (c) 2007, Andrew Bosworth, Facebook, inc. 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are met: 8 | 9 | * Redistributions of source code must retain the above copyright notice, 10 | this list of conditions and the following disclaimer. 11 | * Redistributions in binary form must reproduce the above copyright 12 | notice, this list of conditions and the following disclaimer in the 13 | documentation and/or other materials provided with the distribution. 14 | * Neither the name of Facebook, inc. nor the names of its contributors may 15 | be used to endorse or promote products derived from this software without 16 | specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE 22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /Makefile.am: -------------------------------------------------------------------------------- 1 | # Automake input file. 2 | # $Id$ 3 | 4 | SUBDIRS = src examples 5 | 6 | EXTRA_DIST = phpembedVersion.h.in bootstrap.sh docs SConstruct LICENSE 7 | 8 | -------------------------------------------------------------------------------- /NEWS: -------------------------------------------------------------------------------- 1 | 24 MAR 08: PHPEmbed now supports reentrance on each PHP object and also 2 | multiple PHP objects. You must compile with --enable-maintainer-zts for this 3 | functionality to work 4 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | Archived Repo 2 | ============= 3 | This is an archived project and is no longer supported or updated by Facebook. 4 | Please do not file issues or pull-requests against this repo. If you wish to 5 | continue to develop this code, we recommend you fork it. 6 | 7 | Proceed and be bold! 8 | 9 | --------- 10 | 11 | PHPEMBED (Simplified API built on top of PHP SAPI) 12 | 13 | Andrew Bosworth (boz@facebook.com) 14 | 15 | Last Modified: 2008-Mar-23 16 | 17 | Phpembed is distributed under the Phpembed open source software license. 18 | Please see the included LICENSE file. 19 | 20 | For more information on phpmbed usage see documentation in ./docs 21 | 22 | Installing phpembed 23 | ============================== 24 | 25 | Pre-Requisites: 26 | ================================ 27 | 28 | php 5.x must be installed with --enable-embed option turned on. 29 | [ To enable building of embedded SAPI library ] 30 | 31 | 32 | Building phpembed library: 33 | ======================================= 34 | NOTE: The phpembed library is just a more accessible and simplified library 35 | built on top of of the PHP SAPI. 36 | 37 | If you are building from the first time out of the source repository, you will 38 | need to generate the configure scripts. From the top directory, do: 39 | 40 | ./bootstrap.sh 41 | 42 | Once the configure scripts are generated, phpembed can be configured. 43 | From the top directory, do: 44 | 45 | ./configure [ default shared mode] 46 | 47 | Run ./configure --help to see other configuration options 48 | 49 | Make phpembed: 50 | 51 | make 52 | 53 | Install phpembed as superuser: 54 | 55 | make install 56 | 57 | Note: To run bootstrap you may need the following: 58 | 59 | automake / aclocal -- 1.9.5 60 | autoconf -- 2.59 61 | autoheader -- 2.59 62 | libtool -- 1.5.16 63 | 64 | 65 | -------------------------------------------------------------------------------- /SConstruct: -------------------------------------------------------------------------------- 1 | # 2 | # DIRECTORY VARIABLES 3 | # to keep code maximally portable, keep ALL directory references here 4 | # 5 | 6 | src = '#src/' 7 | examples = '#examples/' 8 | phpd = '/usr/local/php/include/php/' 9 | phpdirs = [phpd, phpd+'Zend/', phpd+'TSRM/', phpd+'main/', phpd+'sapi/embed/'] 10 | 11 | 12 | # 13 | # DEFINE BUILD ENVIRONMENT 14 | # universal setting used for all programs for compilation 15 | # 16 | 17 | env = Environment(CPPFLAGS='-Wall -g', 18 | CPPPATH=phpdirs + [src], 19 | LINKFLAGS='`php-config --includes` `php-config --ldflags` `php-config --libs`') 20 | 21 | libtarget = "phpembed" 22 | libsources = [src + 'php_cxx.cpp', src + 'php_arr.cpp', 23 | src + 'php_stl.cpp', src + 'php_tok.cpp'] 24 | env.StaticLibrary(target = libtarget, source = libsources) 25 | 26 | 27 | # 28 | # BUILD EXECUTABLES 29 | # go to all children and execute their SConscripts 30 | # 31 | 32 | test = env.Program(target = 'test', 33 | source = [examples + 'test.cpp', 34 | 'libphpembed.a', 35 | '/usr/local/php/lib/libphp5.a'], 36 | LIBS = '', 37 | LIBPATH = '') 38 | 39 | example = env.Program(target = 'example', 40 | source = [examples + 'example.cpp', 41 | 'libphpembed.a', 42 | '/usr/local/php/lib/libphp5.a'], 43 | LIBS = '', 44 | LIBPATH = '') 45 | 46 | usage = env.Program(target = 'usage', 47 | source = [examples + 'usage.cpp', 48 | 'libphpembed.a', 49 | '/usr/local/php/lib/libphp5.a'], 50 | LIBS = '', 51 | LIBPATH = '') 52 | -------------------------------------------------------------------------------- /bootstrap.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # $Id$ 3 | 4 | # Script to set up compilation environment. 5 | 6 | touch AUTHORS ChangeLog 7 | 8 | LIBTOOLIZE=${LIBTOOLIZE:-`which libtoolize`} 9 | if test -f "${LIBTOOLIZE}"; then 10 | echo "libtoolize..." 11 | $LIBTOOLIZE --automake -c 12 | else 13 | echo "Error libtoolize missing. Must install libtools package." 14 | exit 1 15 | fi 16 | 17 | echo "aclocal..." 18 | ACLOCAL=${ACLOCAL:-aclocal} 19 | $ACLOCAL || exit 1 20 | 21 | echo "autoheader..." 22 | AUTOHEADER=${AUTOHEADER:-autoheader} 23 | $AUTOHEADER || exit 1 24 | 25 | echo "automake..." 26 | AUTOMAKE=${AUTOMAKE:-automake} 27 | $AUTOMAKE -ac 28 | 29 | echo "autoconf..." 30 | AUTOCONF=${AUTOCONF:-autoconf} 31 | $AUTOCONF || exit 1 32 | 33 | make clean 1>/dev/null 2>&1 34 | -------------------------------------------------------------------------------- /docs/phpembed.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookarchive/phpembed/b269630118c8e70c48d5b90f55d167304abd9673/docs/phpembed.pdf -------------------------------------------------------------------------------- /docs/www/footnode.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | Footnotes 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 |
... case.1
30 |
Bjarne Stroustrup would approve: http://www.research.att.com/~bs/bs_faq2.html 32 | 33 |
.
34 | .
35 | .
36 | .
37 | .
38 | .
39 | .
40 | .
41 | .
42 | .
43 | .
44 | .
45 | .
46 | .
47 | .
48 | .
49 | .
50 | .
51 | .
52 | .
53 | .
54 | .
55 | .
56 | .
57 | .
58 | .
59 | .
60 | .
61 | .
62 | .
63 | 
64 |
65 |
66 | 67 | 68 | -------------------------------------------------------------------------------- /docs/www/image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookarchive/phpembed/b269630118c8e70c48d5b90f55d167304abd9673/docs/www/image.png -------------------------------------------------------------------------------- /docs/www/internals.pl: -------------------------------------------------------------------------------- 1 | # LaTeX2HTML 2002-2-1 (1.70) 2 | # Associate internals original text with physical files. 3 | 4 | 5 | $key = q/Table1/; 6 | $ref_files{$key} = "$dir".q|node9.html|; 7 | $noresave{$key} = "$nosave"; 8 | 9 | $key = q/Table2/; 10 | $ref_files{$key} = "$dir".q|node11.html|; 11 | $noresave{$key} = "$nosave"; 12 | 13 | 1; 14 | 15 | -------------------------------------------------------------------------------- /docs/www/labels.pl: -------------------------------------------------------------------------------- 1 | # LaTeX2HTML 2002-2-1 (1.70) 2 | # Associate labels original text with physical files. 3 | 4 | 5 | $key = q/Table1/; 6 | $external_labels{$key} = "$URL/" . q|node9.html|; 7 | $noresave{$key} = "$nosave"; 8 | 9 | $key = q/Table2/; 10 | $external_labels{$key} = "$URL/" . q|node11.html|; 11 | $noresave{$key} = "$nosave"; 12 | 13 | 1; 14 | 15 | 16 | # LaTeX2HTML 2002-2-1 (1.70) 17 | # labels from external_latex_labels array. 18 | 19 | 20 | $key = q/Table1/; 21 | $external_latex_labels{$key} = q|5.3|; 22 | $noresave{$key} = "$nosave"; 23 | 24 | $key = q/Table2/; 25 | $external_latex_labels{$key} = q|5.5|; 26 | $noresave{$key} = "$nosave"; 27 | 28 | 1; 29 | 30 | -------------------------------------------------------------------------------- /docs/www/node101.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | php_type 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 31 | next 33 | 35 | up 37 | 39 | previous 41 | 43 | contents 45 |
46 | Next: php_tok 48 | Up: Function Reference 50 | Previous: php_stl::call_uint_vector 52 |   Contents 54 |
55 |
56 | 57 | 58 |

59 | php_type 60 |

61 | 62 |

63 |

 64 | #include "php_arr.h"
 65 | 
 66 | typedef zend_uchar php_type;
 67 | 
68 | 69 |

70 | Description: This is just a wrapper for an unsigned char type and it represents the possible data types for values in PHP. This is particularly useful when working with PHP arrays since any key or value can be of nearly any type. The following table (reproduced from Table 2) details the possible return types as well as which types are supported in C++ and which are not. 71 | 72 |

73 |
74 |

75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 |
SupportedUnsupported
IS_LONGIS_NULL
IS_DOUBLEIS_OBJECT
IS_STRINGIS_RESOURCE
IS_BOOLIS_CONSTANT
IS_ARRAYanything else
95 |
96 |
97 | 98 |

99 |


100 |
101 | Andrew Bosworth 102 | 2008-03-24 103 |
104 | 105 | 106 | -------------------------------------------------------------------------------- /docs/www/node102.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | php_tok 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 30 | next 32 | 34 | up 36 | 38 | previous 40 | 42 | contents 44 |
45 | Next: License and Copyright 47 | Up: Function Reference 49 | Previous: php_type 51 |   Contents 53 |
54 |
55 | 56 | 57 |

58 | php_tok 59 |

60 | 61 |

62 | This library could be used to tokenize an arbitrary number of PHP files hierarchically for preprocessing in C++, but there is no example usage, active development, or support for it at this time. 63 | 64 |

65 | 66 |


67 |
68 | Andrew Bosworth 69 | 2008-03-24 70 |
71 | 72 | 73 | -------------------------------------------------------------------------------- /docs/www/node104.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | Contact 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 31 | next 33 | 35 | up 37 | 39 | previous 41 | 43 | contents 45 |
46 | Next: About this document ... 48 | Up: PHPEmbed 50 | Previous: License and Copyright 52 |   Contents 54 |
55 |
56 | 57 | 58 |

59 | Contact 60 |

61 | 62 |

63 | Post feedback, patches, or bug reports to the discussion board on the 64 |
PHPEmbed Facebook Group 66 |

67 |


68 |
69 | Andrew Bosworth 70 | 2008-03-24 71 |
72 | 73 | 74 | -------------------------------------------------------------------------------- /docs/www/node105.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | About this document ... 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | next 29 | 31 | up 33 | 35 | previous 37 | 39 | contents 41 |
42 | Up: PHPEmbed 44 | Previous: Contact 46 |   Contents 48 |
49 |
50 | 51 | 52 |

53 | About this document ... 54 |

55 | PHPEmbed

56 | This document was generated using the 57 | LaTeX2HTML translator Version 2002-2-1 (1.70) 58 |

59 | Copyright © 1993, 1994, 1995, 1996, 60 | Nikos Drakos, 61 | Computer Based Learning Unit, University of Leeds. 62 |
63 | Copyright © 1997, 1998, 1999, 64 | Ross Moore, 65 | Mathematics Department, Macquarie University, Sydney. 66 |

67 | The command line arguments were:
68 | latex2html phpembed.tex 70 |

71 | The translation was initiated by Andrew Bosworth on 2008-03-24 72 |


73 |
74 | Andrew Bosworth 75 | 2008-03-24 76 |
77 | 78 | 79 | -------------------------------------------------------------------------------- /docs/www/node12.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | Additional Examples 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 30 | next 32 | 34 | up 36 | 38 | previous 40 | 42 | contents 44 |
45 | Next: Frequently Asked Questions 47 | Up: Usage 49 | Previous: Navigating PHP Arrays 51 |   Contents 53 |
54 |
55 | 56 | 57 |

58 | Additional Examples 59 |

60 | 61 |

62 | The example discussed in this section is implemented in the provided source code as usage.cpp. The source code also includes example.cpp and example.php which implement similar simple examples. In addition to that, there is a (relatively superficial) unit testing framework in test.cpp and test.php which will provide a working example of nearly every function available in the API. 63 | 64 |

65 |


66 |
67 | Andrew Bosworth 68 | 2008-03-24 69 |
70 | 71 | 72 | -------------------------------------------------------------------------------- /docs/www/node13.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | Frequently Asked Questions 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 31 | next 33 | 35 | up 37 | 39 | previous 41 | 43 | contents 45 |
46 | Next: Why not use macros 48 | Up: PHPEmbed 50 | Previous: Additional Examples 52 |   Contents 54 |
55 |
56 | 57 | 58 |

59 | Frequently Asked Questions 60 |

61 | 62 |

63 |


64 | 65 | Subsections 66 | 67 | 79 | 80 |

81 |
82 | Andrew Bosworth 83 | 2008-03-24 84 |
85 | 86 | 87 | -------------------------------------------------------------------------------- /docs/www/node14.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | Why not use macros instead of repeating so much code? 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 31 | next 33 | 35 | up 37 | 39 | previous 41 | 43 | contents 45 |
46 | Next: Why do I keep 48 | Up: Frequently Asked Questions 50 | Previous: Frequently Asked Questions 52 |   Contents 54 |
55 |
56 | 57 | 58 |

59 | Why not use macros instead of repeating so much code? 60 |

61 | Macros can be convenient but they can also make code difficult to read and understand. Furthermore, Macros only provide a potential improvement in performance when inlining otherwise large and unwieldy sections of code which doesn't apply to this library. We hate code replication as much as anyone but we believe in clarity above all else. 62 | 63 |

64 |


65 |
66 | Andrew Bosworth 67 | 2008-03-24 68 |
69 | 70 | 71 | -------------------------------------------------------------------------------- /docs/www/node15.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | Why do I keep running out of memory? 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 31 | next 33 | 35 | up 37 | 39 | previous 41 | 43 | contents 45 |
46 | Next: Can I have multiple 48 | Up: Frequently Asked Questions 50 | Previous: Why not use macros 52 |   Contents 54 |
55 |
56 | 57 | 58 |

59 | Why do I keep running out of memory? 60 |

61 | PHP rarely runs beyond its memory limit in apache because the instance only lives for the time it takes to serve one page and then that thread dies and the memory is freed. The embedded environment, however, sticks around and hence requires vigilance around declaring variables in global scope and failing to clean them up with unset. Additionally, it may help to increase the allowed operating memory by using the ini_set function before loading any PHP scripts, for example: ini_set('memory_limit', '100M'); 62 | 63 |

64 | There are also a few known leaks in the PHP core, using the builtin PHP function memory_get_usage() in conjunction with the memory_limit ini setting will enable any client of PHPEmbed to predict a memory problem before it affects program operation and handle it as appropriate, for example by destroying the PHP object and recreating it. 65 | 66 |

67 |


68 |
69 | Andrew Bosworth 70 | 2008-03-24 71 |
72 | 73 | 74 | -------------------------------------------------------------------------------- /docs/www/node16.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | Can I have multiple instances of PHPEmbed in one program? 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 31 | next 33 | 35 | up 37 | 39 | previous 41 | 43 | contents 45 |
46 | Next: Is the PHPEMbed library 48 | Up: Frequently Asked Questions 50 | Previous: Why do I keep 52 |   Contents 54 |
55 |
56 | 57 | 58 |

59 | Can I have multiple instances of PHPEmbed in one program? 60 |

61 | Yes, this version of PHPEmbed can support multiple PHP objects in a single binary if it is compiled with Zend Thread Safety (ZTS) enabled. This is still experimental so there may be bugs, especially around memory usage, but each object operates in its own memory so they can be used concurrently. If the access to the PHP object is relatively sparse it may be worth using a single PHP object and passing it to multiple threads. 62 | 63 |

64 |


65 |
66 | Andrew Bosworth 67 | 2008-03-24 68 |
69 | 70 | 71 | -------------------------------------------------------------------------------- /docs/www/node162.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | Is the PHPEmbed library reentrant? 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 31 | next 33 | 35 | up 37 | 39 | previous 41 | 43 | contents 45 |
46 | Next: Will this library work 48 | Up: Frequently Asked Questions 50 | Previous: Can I have multiple 52 |   Contents 54 |
55 |
56 | 57 | 58 |

59 | Is the PHPEmbed library reentrant? 60 |

61 | Yes, this version of PHPEmbed supports reentrance if it is compiled with ZTS support. However, bceause it is simply putting a lock on the interpreter during any operation this will not be particularly useful for applications where there is a lot of concurrent access to the PHP object, in those cases it may be worth using multiple PHP instances. 62 | 63 |

64 |


65 |
66 | Andrew Bosworth 67 | 2008-03-24 68 |
69 | 70 | 71 | -------------------------------------------------------------------------------- /docs/www/node17.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | Will this library work on my platform? 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 30 | next 32 | 34 | up 36 | 38 | previous 40 | 42 | contents 44 |
45 | Next: Function Reference 47 | Up: Frequently Asked Questions 49 | Previous: Is the PHPEmbed library 51 |   Contents 53 |
54 |
55 | 56 | 57 |

58 | Will this library work on my platform? 59 |

60 | We have only tested this software on 64-bit linux architectures, and there is no guarantee it will even work there. That being said, if you can compile PHP on your machine you should be able to compile and use PHPEmbed. 61 | 62 |

63 |


64 |
65 | Andrew Bosworth 66 | 2008-03-24 67 |
68 | 69 | 70 | -------------------------------------------------------------------------------- /docs/www/node19.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | php 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 31 | next 33 | 35 | up 37 | 39 | previous 41 | 43 | contents 45 |
46 | Next: php::call_bool 48 | Up: Function Reference 50 | Previous: Function Reference 52 |   Contents 54 |
55 |
56 | 57 | 58 |

59 | php 60 |

61 | 62 |

63 |

64 | #include "php_cxx.h"
65 | 
66 | class php {
67 | public:
68 |   php(bool type_warnings = false);
69 |   ~php();
70 |   ...
71 | };
72 | 
73 | 74 |

75 | Description: The php object is the center of access for the embedded PHP interpreter. The type_warnings value is optional and defaults to false. If set to true the interpreter will send a string to the error function (see php::set_error_function) when it is forced to use PHP type conversion to get an object into the required C++ data type. 76 | 77 |

78 | Errors: Any errors during initialization will result in the status flag (see php::status) being set to a nonzero value. 79 | 80 |

81 |


82 |
83 | Andrew Bosworth 84 | 2008-03-24 85 |
86 | 87 | 88 | -------------------------------------------------------------------------------- /docs/www/node2.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | Motivation 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 31 | next 33 | 35 | up 37 | 39 | previous 41 | 43 | contents 45 |
46 | Next: Design 48 | Up: PHPEmbed 50 | Previous: Contents 52 |   Contents 54 |
55 |
56 | 57 | 58 |

59 | Motivation 60 |

61 | 62 |

63 | PHP has solidified itself as the language of choice for many top internet properties largely due to its ease of use and seamless integration with apache and MySQL. It is also a fine scripting language for quick and easy data consumption or modification. Despite its suitability for web development and scripting, PHP is generally not the best choice for most standalone programs or servers. Unfortunately, when there are many developers actively maintaining a PHP code base for a website it creates a dangerous dependency to have a separate code path to the data layer in another language. If the cache keys or database schema were to change in the PHP code base then the corollary compiled program would be broken (and potentially corrupting data) until the code was updated and the program recompiled and restarted. 64 | 65 |

66 | Faced with this problem we endeavored to embed the PHP Interpreter into C++ binaries. This isn't a novel endeavor by any means; the aforementioned seamless Apache integration uses the PHP Server API (SAPI) to accomplish exactly that. However, when we began attempting integration of our own we found that the SAPI required quite a bit of expertise to manipulate effectively. 67 | 68 |

69 | In order to make embedding PHP truly simple for all of our developers (and indeed the world) we developed this PHPEmbed library which is just a more accessible and simplified API built on top of the PHP SAPI. 70 | 71 |

72 |


73 | 74 | 76 | next 78 | 80 | up 82 | 84 | previous 86 | 88 | contents 90 |
91 | Next: Design 93 | Up: PHPEmbed 95 | Previous: Contents 97 |   Contents 99 | 100 |
101 | Andrew Bosworth 102 | 2008-03-24 103 |
104 | 105 | 106 | -------------------------------------------------------------------------------- /docs/www/node20.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | php::call_bool 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 31 | next 33 | 35 | up 37 | 39 | previous 41 | 43 | contents 45 |
46 | Next: php::call_bool_arr 48 | Up: Function Reference 50 | Previous: php 52 |   Contents 54 |
55 |
56 | 57 | 58 |

59 | php::call_bool 60 |

61 | 62 |

63 |

64 | #include "php_cxx.h"
65 | 
66 | bool 
67 | php::call_bool(char *fn, char *argspec = "", ...);
68 | 
69 | 70 |

71 | Description: Call the PHP function fn with the arguments described by argspec and included as subsequent arguments. If argspec is not specified the function will be called without any arguments. The value returned by PHP will be interpreted as a bool. If PHP type conversion is necessary it may generate a type mismatch warning if those warnings are enabled. 72 | 73 |

74 | Errors: It is an error for the number of arguments described in argspec to differ from the number of arguments provided thereafter. It is an error for the types of additional arguments to differ from their description in argspec(see Table 1 on page [*] for details). Any internal errors during execution will result in the status flag (see php::status) being set to a nonzero value. 76 | 77 |

78 |


79 |
80 | Andrew Bosworth 81 | 2008-03-24 82 |
83 | 84 | 85 | -------------------------------------------------------------------------------- /docs/www/node22.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | php::call_c_string 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 31 | next 33 | 35 | up 37 | 39 | previous 41 | 43 | contents 45 |
46 | Next: php::call_c_string_arr 48 | Up: Function Reference 50 | Previous: php::call_bool_arr 52 |   Contents 54 |
55 |
56 | 57 | 58 |

59 | php::call_c_string 60 |

61 | 62 |

63 |

64 | #include "php_cxx.h"
65 | 
66 | char *
67 | php::call_c_string(char *fn, char *argspec = "", ...);
68 | 
69 | 70 |

71 | Description: Call the PHP function fn with the arguments described by argspec and included as subsequent arguments. If argspec is not specified the function will be called without any arguments. The value returned by PHP will be interpreted as a C style string. If PHP type conversion is necessary it may generate a type mismatch warning if those warnings are enabled. The memory for this string is maintained by the php object so if that object is destroyed the string is no longer valid; if the string value needs to persist beyond the life of the php object then it must be copied. 72 | 73 |

74 | Errors: It is an error for the number of arguments described in argspec to differ from the number of arguments provided thereafter. It is an error for the types of additional arguments to differ from their description in argspec(see Table 1 on page [*] for details). Any internal errors during execution will result in the status flag (see php::status) being set to a nonzero value. 76 | 77 |

78 |


79 |
80 | Andrew Bosworth 81 | 2008-03-24 82 |
83 | 84 | 85 | -------------------------------------------------------------------------------- /docs/www/node24.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | php::call_double 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 31 | next 33 | 35 | up 37 | 39 | previous 41 | 43 | contents 45 |
46 | Next: php::call_double_arr 48 | Up: Function Reference 50 | Previous: php::call_c_string_arr 52 |   Contents 54 |
55 |
56 | 57 | 58 |

59 | php::call_double 60 |

61 | 62 |

63 |

64 | #include "php_cxx.h"
65 | 
66 | double 
67 | php::call_double(char *fn, char *argspec = "", ...);
68 | 
69 | 70 |

71 | Description: Call the PHP function fn with the arguments described by argspec and included as subsequent arguments. If argspec is not specified the function will be called without any arguments. The value returned by PHP will be interpreted as a double. If PHP type conversion is necessary it may generate a type mismatch warning if those warnings are enabled. 72 | 73 |

74 | Errors: It is an error for the number of arguments described in argspec to differ from the number of arguments provided thereafter. It is an error for the types of additional arguments to differ from their description in argspec(see Table 1 on page [*] for details). Any internal errors during execution will result in the status flag (see php::status) being set to a nonzero value. 76 | 77 |

78 |


79 |
80 | Andrew Bosworth 81 | 2008-03-24 82 |
83 | 84 | 85 | -------------------------------------------------------------------------------- /docs/www/node27.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | php::call_long 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 31 | next 33 | 35 | up 37 | 39 | previous 41 | 43 | contents 45 |
46 | Next: php::call_long_array 48 | Up: Function Reference 50 | Previous: php::call_int_array 52 |   Contents 54 |
55 |
56 | 57 | 58 |

59 | php::call_long 60 |

61 | 62 |

63 |

64 | #include "php_cxx.h"
65 | 
66 | long 
67 | php::call_long(char *fn, char *argspec = "", ...);
68 | 
69 | 70 |

71 | Description: Call the PHP function fn with the arguments described by argspec and included as subsequent arguments. If argspec is not specified the function will be called without any arguments. The value returned by PHP will be interpreted as a long. If PHP type conversion is necessary it may generate a type mismatch warning if those warnings are enabled. 72 | 73 |

74 | Errors: It is an error for the number of arguments described in argspec to differ from the number of arguments provided thereafter. It is an error for the types of additional arguments to differ from their description in argspec(see Table 1 on page [*] for details). Any internal errors during execution will result in the status flag (see php::status) being set to a nonzero value. 76 | 77 |

78 |


79 |
80 | Andrew Bosworth 81 | 2008-03-24 82 |
83 | 84 | 85 | -------------------------------------------------------------------------------- /docs/www/node29.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | php::call_php_array 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 31 | next 33 | 35 | up 37 | 39 | previous 41 | 43 | contents 45 |
46 | Next: php::call_uint_array 48 | Up: Function Reference 50 | Previous: php::call_long_array 52 |   Contents 54 |
55 |
56 | 57 | 58 |

59 | php::call_php_array 60 |

61 | 62 |

63 |

64 | #include "php_cxx.h"
65 | 
66 | php_array 
67 | php::call_php_array(char *fn, char *argspec = "", ...);
68 | 
69 | 70 |

71 | Description: Call the PHP function fn with the arguments described by argspec and included as subsequent arguments. If argspec is not specified the function will be called without any arguments. The value returned by PHP will be interpreted as an array. If PHP type conversion is necessary it may generate a type mismatch warning if those warnings are enabled. 72 | 73 |

74 | Errors: It is an error for the number of arguments described in argspec to differ from the number of arguments provided thereafter. It is an error for the types of additional arguments to differ from their description in argspec(see Table 1 on page [*] for details). Any internal errors during execution will result in the status flag (see php::status) being set to a nonzero value. 76 | 77 |

78 |


79 |
80 | Andrew Bosworth 81 | 2008-03-24 82 |
83 | 84 | 85 | -------------------------------------------------------------------------------- /docs/www/node31.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | php::call_void 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 31 | next 33 | 35 | up 37 | 39 | previous 41 | 43 | contents 45 |
46 | Next: php::eval_string 48 | Up: Function Reference 50 | Previous: php::call_uint_array 52 |   Contents 54 |
55 |
56 | 57 | 58 |

59 | php::call_void 60 |

61 | 62 |

63 |

64 | #include "php_cxx.h"
65 | 
66 | void 
67 | php::call_void(char *fn, char *argspec = "", ...);
68 | 
69 | 70 |

71 | Description: Call the PHP function fn with the arguments described by argspec and included as subsequent arguments. If argspec is not specified the function will be called without any arguments. Any value returned by PHP will be ignored. 72 | 73 |

74 | Errors: It is an error for the number of arguments described in argspec to differ from the number of arguments provided thereafter. It is an error for the types of additional arguments to differ from their description in argspec(see Table 1 on page [*] for details). Any internal errors during execution will result in the status flag (see php::status) being set to a nonzero value. 76 | 77 |

78 |


79 |
80 | Andrew Bosworth 81 | 2008-03-24 82 |
83 | 84 | 85 | -------------------------------------------------------------------------------- /docs/www/node32.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | php::eval_string 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 31 | next 33 | 35 | up 37 | 39 | previous 41 | 43 | contents 45 |
46 | Next: php::load 48 | Up: Function Reference 50 | Previous: php::call_void 52 |   Contents 54 |
55 |
56 | 57 | 58 |

59 | php::eval_string 60 |

61 | 62 |

63 |

64 | #include "php_cxx.h"
65 | 
66 | void 
67 | php::eval_string(const char *fmt, ...);
68 | 
69 | 70 |

71 | Description: Use the PHP interpreter to evaluate string fmt with any printf style format arguments substituted for the value in the additional arguments. NOTE: This function is made available for more advanced clients but its use is generally discouraged. 72 | 73 |

74 | Example: The php::load function is actually implemented very simply as: 75 | 76 |

77 | php_ret php::load(const char *filename)
78 | {   
79 |   return eval_string("include_once('%s');", filename);
80 | }
81 | 
82 | 83 |

84 | Note the inclusion of the semicolon as the interpreter will treat the string being evaluated as a line of PHP code. 85 | 86 |

87 | Errors: It is an error for the types or count of format specifiers in fmt to differ from the additional arguments passed. Any internal errors during execution will result in the status flag (see php::status) being set to a nonzero value. 88 | 89 |

90 |


91 |
92 | Andrew Bosworth 93 | 2008-03-24 94 |
95 | 96 | 97 | -------------------------------------------------------------------------------- /docs/www/node33.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | php::load 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 31 | next 33 | 35 | up 37 | 39 | previous 41 | 43 | contents 45 |
46 | Next: php::set_error_function 48 | Up: Function Reference 50 | Previous: php::eval_string 52 |   Contents 54 |
55 |
56 | 57 | 58 |

59 | php::load 60 |

61 | 62 |

63 |

64 | #include "php_cxx.h"
65 | 
66 | void 
67 | php::load(const char *filename);
68 | 
69 | 70 |

71 | Description: Direct the PHP interpreter to parse all the code in filename. This function is really just a wrapper around the PHP builtin include_once. 72 | 73 |

74 | Errors: Any internal errors during execution will result in the status flag (see php::status) being set to a nonzero value. 75 | 76 |

77 |


78 |
79 | Andrew Bosworth 80 | 2008-03-24 81 |
82 | 83 | 84 | -------------------------------------------------------------------------------- /docs/www/node34.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | php::set_error_function 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 31 | next 33 | 35 | up 37 | 39 | previous 41 | 43 | contents 45 |
46 | Next: php::set_message_function 48 | Up: Function Reference 50 | Previous: php::load 52 |   Contents 54 |
55 |
56 | 57 | 58 |

59 | php::set_error_function 60 |

61 | 62 |

63 |

64 | #include "php_cxx.h"
65 | 
66 | void 
67 | set_error_function(void (*error_function)(const char *));
68 | 
69 | 70 |

71 | Description: This function controls the behavior of error output from the php object. This class of output contains all the error strings generated by the php object itself as it attempts to process the commands given. Such errors could result from improper argument passing, illegal function calling, or any generic malfunction in the core PHP interpreter code. The default behavior of the php libraries is to print this to stderr prepended with the string ``PHP ERROR:.'' NOTE: The optional type mismatch errors in the PHP object fall into this class of output. If set, php will call error_function with a const char * string containing the error. 72 | 73 |

74 |


75 |
76 | Andrew Bosworth 77 | 2008-03-24 78 |
79 | 80 | 81 | -------------------------------------------------------------------------------- /docs/www/node35.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | php::set_message_function 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 31 | next 33 | 35 | up 37 | 39 | previous 41 | 43 | contents 45 |
46 | Next: php::set_output_function 48 | Up: Function Reference 50 | Previous: php::set_error_function 52 |   Contents 54 |
55 |
56 | 57 | 58 |

59 | php::set_message_function 60 |

61 | 62 |

63 |

64 | #include "php_cxx.h"
65 | 
66 | void 
67 | set_message_function(void (*message_function)(const char *));
68 | 
69 | 70 |

71 | Description: This function controls the behavior of message output from the php object. This class of output contains all the strings which represent errors or warnings produced in the interpretation of PHP but not fatal errors for the PHP interpreter itself or the php object. Good examples are calling an undefined function in PHP or using a non-array in the PHP foreach construct. The default behavior of the php libraries is to print these strings to stderr prepended with the string ``PHP MESSAGE:.'' If set, php will call message_function with a const char * string containing the message. 72 | 73 |

74 |


75 |
76 | Andrew Bosworth 77 | 2008-03-24 78 |
79 | 80 | 81 | -------------------------------------------------------------------------------- /docs/www/node36.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | php::set_output_function 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 31 | next 33 | 35 | up 37 | 39 | previous 41 | 43 | contents 45 |
46 | Next: php::status 48 | Up: Function Reference 50 | Previous: php::set_message_function 52 |   Contents 54 |
55 |
56 | 57 | 58 |

59 | php::set_output_function 60 |

61 | 62 |

63 |

64 | #include "php_cxx.h"
65 | 
66 | void 
67 | set_output_function(void (*output_function)(const char *));
68 | 
69 | 70 |

71 | Description: This function controls the behavior of operational output from the php object. This class of output contains all the strings produced in PHP by such commands as echo, print, or printf. The default behavior of the php libraries is to print these strings to stdout prepended with the string ``PHP OUTPUT:''. NOTE: Due to its primarily application as a hypertext processor the default behavior in PHP is to only flush the output buffer when the PHP interpreter is destroyed; to get the output flushed sooner use the PHP function ob_flush(). If set, php will call output_function with a const char * string containing the output. 72 | 73 |

74 |


75 |
76 | Andrew Bosworth 77 | 2008-03-24 78 |
79 | 80 | 81 | -------------------------------------------------------------------------------- /docs/www/node37.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | php::status 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 31 | next 33 | 35 | up 37 | 39 | previous 41 | 43 | contents 45 |
46 | Next: php_array 48 | Up: Function Reference 50 | Previous: php::set_output_function 52 |   Contents 54 |
55 |
56 | 57 | 58 |

59 | php::status 60 |

61 | 62 |

63 |

64 | #include "php_cxx.h"
65 | 
66 | class php{
67 | public:
68 |    ...
69 |    php_ret status;
70 | };
71 | 
72 | 73 |

74 | Description: This is a public variable of the php class that indicates the status of the class, generally in reference to the most recently executed command. If the status is ever nonzero the class should be destroyed. Although nearly every operation in the php and php_stl classes has the potential to affect status, it may be sufficient to rely on error output to detect problems and only check status after initialization. 75 | 76 |

77 |


78 |
79 | Andrew Bosworth 80 | 2008-03-24 81 |
82 | 83 | 84 | -------------------------------------------------------------------------------- /docs/www/node38.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | php_array 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 31 | next 33 | 35 | up 37 | 39 | previous 41 | 43 | contents 45 |
46 | Next: php_array::add 48 | Up: Function Reference 50 | Previous: php::status 52 |   Contents 54 |
55 |
56 | 57 | 58 |

59 | php_array 60 |

61 | 62 |

63 |

64 | #include "php_arr.h"
65 | 
66 | class php_array{
67 | public:
68 |    php_array();
69 |    ~php_array();
70 | };
71 | 
72 | 73 |

74 | Description: The php_array object is an object which implements the creation and storage of nested and arbitrarily typed key-value pairs for transporting complex data to and from PHP functions. 75 | 76 |

77 |


78 |
79 | Andrew Bosworth 80 | 2008-03-24 81 |
82 | 83 | 84 | -------------------------------------------------------------------------------- /docs/www/node39.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | php_array::add 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 31 | next 33 | 35 | up 37 | 39 | previous 41 | 43 | contents 45 |
46 | Next: php_array::add_assoc 48 | Up: Function Reference 50 | Previous: php_array 52 |   Contents 54 |
55 |
56 | 57 | 58 |

59 | php_array::add 60 |

61 | 62 |

63 |

64 | #include "php_arr.h"
65 | 
66 | void 
67 | php_array::add(char *argspec, ...);
68 | 
69 | 70 |

71 | Description: Add each value described by argspec and included as subsequent arguments to the php_array at the next available index. This is logically equivalent to taking each value passed in and calling $php_array[] = $value; in PHP. 72 | 73 |

74 | Errors: It is an error for argspec to be undefined. It is an error for the number of values described in argspec to differ from the number of arguments provided thereafter. It is an error for the types of additional arguments to differ from their description in argspec (see Table 1 on page [*] for details). Any errors during execution may result in fewer values than expected being inserted into the array. 76 | 77 |

78 |


79 |
80 | Andrew Bosworth 81 | 2008-03-24 82 |
83 | 84 | 85 | -------------------------------------------------------------------------------- /docs/www/node4.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | Download 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 31 | next 33 | 35 | up 37 | 39 | previous 41 | 43 | contents 45 |
46 | Next: Installation 48 | Up: PHPEmbed 50 | Previous: Design 52 |   Contents 54 |
55 |
56 | 57 | 58 |

59 | Download 60 |

61 | 62 |

63 | Download PHPEmbed at http://www.phpembed.org/ 65 |

66 |


67 |
68 | Andrew Bosworth 69 | 2008-03-24 70 |
71 | 72 | 73 | -------------------------------------------------------------------------------- /docs/www/node40.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | php_array::add_assoc 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 31 | next 33 | 35 | up 37 | 39 | previous 41 | 43 | contents 45 |
46 | Next: php_array::add_index 48 | Up: Function Reference 50 | Previous: php_array::add 52 |   Contents 54 |
55 |
56 | 57 | 58 |

59 | php_array::add_assoc 60 |

61 | 62 |

63 |

 64 | #include "php_arr.h"
 65 | 
 66 | void 
 67 | php_array::add_assoc(char *argspec, ...);
 68 | 
69 | 70 |

71 | Description: Add each pair of values described by argspec and included as subsequent arguments to the php_array as key value pairs. This is logically equivalent to taking each key-value pair passed in and calling $php_array[$key] = $value; in PHP. Since this function adds associative keys to the array, all even values in argspec must be specified as string values (beginning with the 0th index). If a key provided as an argument already exists in the array, its value will be overwritten with the new value provided. 72 | 73 |

74 | Errors: It is an error for argspec to be undefined. It is an error for the number of values described in argspec to differ from the number of arguments provided thereafter. It is an error for an odd number of values to be passed in. It is an error for the types of additional arguments to differ from their description in argspec (see Table 1 on page [*] for details). It is an error for any even values to have type other than char * since associative keys must be strings. Any errors during execution may result in fewer values than expected being inserted into the array. 76 | 77 |

78 |


79 | 80 | 82 | next 84 | 86 | up 88 | 90 | previous 92 | 94 | contents 96 |
97 | Next: php_array::add_index 99 | Up: Function Reference 101 | Previous: php_array::add 103 |   Contents 105 | 106 |
107 | Andrew Bosworth 108 | 2008-03-24 109 |
110 | 111 | 112 | -------------------------------------------------------------------------------- /docs/www/node41.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | php_array::add_index 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 31 | next 33 | 35 | up 37 | 39 | previous 41 | 43 | contents 45 |
46 | Next: php_array::remove 48 | Up: Function Reference 50 | Previous: php_array::add_assoc 52 |   Contents 54 |
55 |
56 | 57 | 58 |

59 | php_array::add_index 60 |

61 | 62 |

63 |

 64 | #include "php_arr.h"
 65 | 
 66 | void 
 67 | php_array::add_index(char *argspec, ...);
 68 | 
69 | 70 |

71 | Description: Add each pair of values described by argspec and included as subsequent arguments to the php_array as key value pairs. This is logically equivalent to taking each key-value pair passed in and calling $php_array[$key] = $value; in PHP. Since this function adds indexed keys to the array, all even values in argspec must be specified as long values (beginning with the 0th index). If a key provided as an argument already exists in the array, its value will be overwritten with the new value provided. 72 | 73 |

74 | Errors: It is an error for argspec to be undefined. It is an error for the number of values described in argspec to differ from the number of arguments provided thereafter. It is an error for an odd number of values to be passed in. It is an error for the types of additional arguments to differ from their description in argspec (see Table 1 on page [*] for details). It is an error for any even values to have type other than long since indexed keys must be numeric. Any errors during execution may result in fewer values than expected being inserted into the array. 76 | 77 |

78 |


79 | 80 | 82 | next 84 | 86 | up 88 | 90 | previous 92 | 94 | contents 96 |
97 | Next: php_array::remove 99 | Up: Function Reference 101 | Previous: php_array::add_assoc 103 |   Contents 105 | 106 |
107 | Andrew Bosworth 108 | 2008-03-24 109 |
110 | 111 | 112 | -------------------------------------------------------------------------------- /docs/www/node42.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | php_array::remove 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 31 | next 33 | 35 | up 37 | 39 | previous 41 | 43 | contents 45 |
46 | Next: php_iterator 48 | Up: Function Reference 50 | Previous: php_array::add_index 52 |   Contents 54 |
55 |
56 | 57 | 58 |

59 | php_array::remove 60 |

61 | 62 |

63 |

64 | #include "php_arr.h"
65 | 
66 | void 
67 | php_array::remove(char *key);
68 | 
69 | void 
70 | php_array::remove(long index);
71 | 
72 | 73 |

74 | Description: Remove key or index and its related value from the php_array. This is logically equivalent to calling either unset($php_array[$key]); or unset($php_array[$index]); in PHP. Calling remove on a key or an index that does not exist in the array does nothing. 75 | 76 |

77 |


78 |
79 | Andrew Bosworth 80 | 2008-03-24 81 |
82 | 83 | 84 | -------------------------------------------------------------------------------- /docs/www/node43.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | php_iterator 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 31 | next 33 | 35 | up 37 | 39 | previous 41 | 43 | contents 45 |
46 | Next: php_iterator::done 48 | Up: Function Reference 50 | Previous: php_array::remove 52 |   Contents 54 |
55 |
56 | 57 | 58 |

59 | php_iterator 60 |

61 | 62 |

63 |

64 | #include "php_arr.h"
65 | 
66 | class php_iterator {
67 | public:
68 |   php_iterator(php_array &a, bool type_warnings = false);
69 |   ~php_iterator();
70 |   ...
71 | };
72 | 
73 | 74 |

75 | Description: The php_iterator object provides access to the keys and values stored in a php_array object. The required php_array a argument is the array this iterator will provide access to. The type_warnings value is optional and defaults to false. If set to true the iterator will write an error to stderr when it is forced to use convert a key or value into the required C++ data type. 76 | 77 |

78 |


79 |
80 | Andrew Bosworth 81 | 2008-03-24 82 |
83 | 84 | 85 | -------------------------------------------------------------------------------- /docs/www/node44.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | php_iterator::done 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 31 | next 33 | 35 | up 37 | 39 | previous 41 | 43 | contents 45 |
46 | Next: php_iterator::get_data_array 48 | Up: Function Reference 50 | Previous: php_iterator 52 |   Contents 54 |
55 |
56 | 57 | 58 |

59 | php_iterator::done 60 |

61 | 62 |

63 |

64 | #include "php_arr.h"
65 | 
66 | bool 
67 | php_iterator::done();
68 | 
69 | 70 |

71 | Description: Returns true if and only if the iterator no longer points to a valid php_array element, either because the array is empty or the iterator has been advanced beyond the bounds of the array in either direction. 72 | 73 |

74 |


75 |
76 | Andrew Bosworth 77 | 2008-03-24 78 |
79 | 80 | 81 | -------------------------------------------------------------------------------- /docs/www/node45.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | php_iterator::get_data_array 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 31 | next 33 | 35 | up 37 | 39 | previous 41 | 43 | contents 45 |
46 | Next: php_iterator::get_data_bool 48 | Up: Function Reference 50 | Previous: php_iterator::done 52 |   Contents 54 |
55 |
56 | 57 | 58 |

59 | php_iterator::get_data_array 60 |

61 | 62 |

63 |

64 | #include "php_arr.h"
65 | 
66 | php_array 
67 | php_iterator::get_data_array();
68 | 
69 | 70 |

71 | Description: Return the value of the element at the current iterator position as a php_array. This function can be used in conjunction with an additional iterator to navigate nested arrays. If the value at the current iterator position isn't of type IS_ARRAY then this function will return a new php_array with a single element whose key is 0 and whose value is the same value and type of the data at the current iterator position and may generate a type mismatch warning if those warnings are enabled. 72 | 73 |

74 | Errors: It is an error to call this function on an iterator in an invalid position (see php_iterator::done). 75 | 76 |

77 |


78 |
79 | Andrew Bosworth 80 | 2008-03-24 81 |
82 | 83 | 84 | -------------------------------------------------------------------------------- /docs/www/node46.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | php_iterator::get_data_bool 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 31 | next 33 | 35 | up 37 | 39 | previous 41 | 43 | contents 45 |
46 | Next: php_iterator::get_data_c_string 48 | Up: Function Reference 50 | Previous: php_iterator::get_data_array 52 |   Contents 54 |
55 |
56 | 57 | 58 |

59 | php_iterator::get_data_bool 60 |

61 | 62 |

63 |

64 | #include "php_arr.h"
65 | 
66 | bool 
67 | php_iterator::get_data_bool();
68 | 
69 | 70 |

71 | Description: Return the value of the element at the current iterator position as a bool. If type conversion is necessary it may generate a type mismatch warning if those warnings are enabled. 72 | 73 |

74 | Errors: It is an error to call this function on an iterator in an invalid position (see php_iterator::done). 75 | 76 |

77 |


78 |
79 | Andrew Bosworth 80 | 2008-03-24 81 |
82 | 83 | 84 | -------------------------------------------------------------------------------- /docs/www/node47.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | php_iterator::get_data_c_string 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 31 | next 33 | 35 | up 37 | 39 | previous 41 | 43 | contents 45 |
46 | Next: php_iterator::get_data_double 48 | Up: Function Reference 50 | Previous: php_iterator::get_data_bool 52 |   Contents 54 |
55 |
56 | 57 | 58 |

59 | php_iterator::get_data_c_string 60 |

61 | 62 |

63 |

64 | #include "php_arr.h"
65 | 
66 | char *
67 | php_iterator::get_data_c_string();
68 | 
69 | 70 |

71 | Description: Return the value of the element at the current iterator position as a char *. If type conversion is necessary it may generate a type mismatch warning if those warnings are enabled. 72 | 73 |

74 | Errors: It is an error to call this function on an iterator in an invalid position (see php_iterator::done). 75 | 76 |

77 |


78 |
79 | Andrew Bosworth 80 | 2008-03-24 81 |
82 | 83 | 84 | -------------------------------------------------------------------------------- /docs/www/node48.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | php_iterator::get_data_double 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 31 | next 33 | 35 | up 37 | 39 | previous 41 | 43 | contents 45 |
46 | Next: php_iterator::get_data_long 48 | Up: Function Reference 50 | Previous: php_iterator::get_data_c_string 52 |   Contents 54 |
55 |
56 | 57 | 58 |

59 | php_iterator::get_data_double 60 |

61 | 62 |

63 |

64 | #include "php_arr.h"
65 | 
66 | double 
67 | php_iterator::get_data_double();
68 | 
69 | 70 |

71 | Description: Return the value of the element at the current iterator position as a double. If type conversion is necessary it may generate a type mismatch warning if those warnings are enabled. 72 | 73 |

74 | Errors: It is an error to call this function on an iterator in an invalid position (see php_iterator::done). 75 | 76 |

77 |


78 |
79 | Andrew Bosworth 80 | 2008-03-24 81 |
82 | 83 | 84 | -------------------------------------------------------------------------------- /docs/www/node49.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | php_iterator::get_data_long 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 31 | next 33 | 35 | up 37 | 39 | previous 41 | 43 | contents 45 |
46 | Next: php_iterator::get_data_type 48 | Up: Function Reference 50 | Previous: php_iterator::get_data_double 52 |   Contents 54 |
55 |
56 | 57 | 58 |

59 | php_iterator::get_data_long 60 |

61 | 62 |

63 |

64 | #include "php_arr.h"
65 | 
66 | long 
67 | php_iterator::get_data_long();
68 | 
69 | 70 |

71 | Description: Return the value of the element at the current iterator position as a long. If type conversion is necessary it may generate a type mismatch warning if those warnings are enabled. 72 | 73 |

74 | Errors: It is an error to call this function on an iterator in an invalid position (see php_iterator::done). 75 | 76 |

77 |


78 |
79 | Andrew Bosworth 80 | 2008-03-24 81 |
82 | 83 | 84 | -------------------------------------------------------------------------------- /docs/www/node5.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | Installation 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 31 | next 33 | 35 | up 37 | 39 | previous 41 | 43 | contents 45 |
46 | Next: Usage 48 | Up: PHPEmbed 50 | Previous: Download 52 |   Contents 54 |
55 |
56 | 57 | 58 |

59 | Installation 60 |

61 | 62 |

63 | See the INSTALL file included in the distribuation. 64 | 65 |

66 |


67 |
68 | Andrew Bosworth 69 | 2008-03-24 70 |
71 | 72 | 73 | -------------------------------------------------------------------------------- /docs/www/node50.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | php_iterator::get_data_type 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 31 | next 33 | 35 | up 37 | 39 | previous 41 | 43 | contents 45 |
46 | Next: php_iterator::get_key_c_string 48 | Up: Function Reference 50 | Previous: php_iterator::get_data_long 52 |   Contents 54 |
55 |
56 | 57 | 58 |

59 | php_iterator::get_data_type 60 |

61 | 62 |

63 |

64 | #include "php_arr.h"
65 | 
66 | php_type 
67 | php_iterator::get_data_type();
68 | 
69 | 70 |

71 | Description: Returns the data type of the value at the current position of the iterator. See php_ret for the list of types. 72 | 73 |

74 | Errors: It is an error to call this function on an iterator in an invalid position (see php_iterator::done). 75 | 76 |

77 |


78 |
79 | Andrew Bosworth 80 | 2008-03-24 81 |
82 | 83 | 84 | -------------------------------------------------------------------------------- /docs/www/node51.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | php_iterator::get_key_c_string 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 31 | next 33 | 35 | up 37 | 39 | previous 41 | 43 | contents 45 |
46 | Next: php_iterator::get_key_long 48 | Up: Function Reference 50 | Previous: php_iterator::get_data_type 52 |   Contents 54 |
55 |
56 | 57 | 58 |

59 | php_iterator::get_key_c_string 60 |

61 | 62 |

63 |

64 | #include "php_arr.h"
65 | 
66 | char *
67 | php_iterator::get_key_c_string();
68 | 
69 | 70 |

71 | Description: Return the key of the element at the current iterator position as a char *. If type conversion is necessary it may generate a type mismatch warning if those warnings are enabled. 72 | 73 |

74 | Errors: It is an error to call this function on an iterator in an invalid position (see php_iterator::done). 75 | 76 |

77 |


78 |
79 | Andrew Bosworth 80 | 2008-03-24 81 |
82 | 83 | 84 | -------------------------------------------------------------------------------- /docs/www/node52.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | php_iterator::get_key_long 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 31 | next 33 | 35 | up 37 | 39 | previous 41 | 43 | contents 45 |
46 | Next: php_iterator::get_key_type 48 | Up: Function Reference 50 | Previous: php_iterator::get_key_c_string 52 |   Contents 54 |
55 |
56 | 57 | 58 |

59 | php_iterator::get_key_long 60 |

61 | 62 |

63 |

64 | #include "php_arr.h"
65 | 
66 | long 
67 | php_iterator::get_key_long();
68 | 
69 | 70 |

71 | Description: Return the key of the element at the current iterator position as a long. If type conversion is necessary it may generate a type mismatch warning if those warnings are enabled. 72 | 73 |

74 | Errors: It is an error to call this function on an iterator in an invalid position (see php_iterator::done). 75 | 76 |

77 |


78 |
79 | Andrew Bosworth 80 | 2008-03-24 81 |
82 | 83 | 84 | -------------------------------------------------------------------------------- /docs/www/node53.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | php_iterator::get_key_type 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 31 | next 33 | 35 | up 37 | 39 | previous 41 | 43 | contents 45 |
46 | Next: php_iterator::go_to_end 48 | Up: Function Reference 50 | Previous: php_iterator::get_key_long 52 |   Contents 54 |
55 |
56 | 57 | 58 |

59 | php_iterator::get_key_type 60 |

61 | 62 |

63 |

64 | #include "php_arr.h"
65 | 
66 | php_type 
67 | php_iterator::get_key_type();
68 | 
69 | 70 |

71 | Description: Return the data type of the key at the current position of the iterator. See php_ret for the list of types. 72 | 73 |

74 | Errors: It is an error to call this function on an iterator in an invalid position (see php_iterator::done). 75 | 76 |

77 |


78 |
79 | Andrew Bosworth 80 | 2008-03-24 81 |
82 | 83 | 84 | -------------------------------------------------------------------------------- /docs/www/node54.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | php_iterator::go_to_end 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 31 | next 33 | 35 | up 37 | 39 | previous 41 | 43 | contents 45 |
46 | Next: php_iterator::go_to_start 48 | Up: Function Reference 50 | Previous: php_iterator::get_key_type 52 |   Contents 54 |
55 |
56 | 57 | 58 |

59 | php_iterator::go_to_end 60 |

61 | 62 |

63 |

64 | #include "php_arr.h"
65 | 
66 | void 
67 | php_iterator::go_to_end();
68 | 
69 | 70 |

71 | Description: Reset the position of the iterator to the last element in the php_array. 72 | 73 |

74 |


75 |
76 | Andrew Bosworth 77 | 2008-03-24 78 |
79 | 80 | 81 | -------------------------------------------------------------------------------- /docs/www/node55.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | php_iterator::go_to_start 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 31 | next 33 | 35 | up 37 | 39 | previous 41 | 43 | contents 45 |
46 | Next: php_iterator::operator- 48 | Up: Function Reference 50 | Previous: php_iterator::go_to_end 52 |   Contents 54 |
55 |
56 | 57 | 58 |

59 | php_iterator::go_to_start 60 |

61 | 62 |

63 |

64 | #include "php_arr.h"
65 | 
66 | void 
67 | php_iterator::go_to_end();
68 | 
69 | 70 |

71 | Description: Reset the position of the iterator to the first element in the php_array. 72 | 73 |

74 |


75 |
76 | Andrew Bosworth 77 | 2008-03-24 78 |
79 | 80 | 81 | -------------------------------------------------------------------------------- /docs/www/node56.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | php_iterator::operator- 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 31 | next 33 | 35 | up 37 | 39 | previous 41 | 43 | contents 45 |
46 | Next: php_iterator::operator++ 48 | Up: Function Reference 50 | Previous: php_iterator::go_to_start 52 |   Contents 54 |
55 |
56 | 57 | 58 |

59 | php_iterator::operator- 60 |

61 | 62 |

63 |

64 | #include "php_arr.h"
65 | 
66 | void 
67 | php_iterator::operator--(int ignore);
68 | 
69 | 70 |

71 | Description: Move the iterator to the previous element in the php_array. If it was previously on the first element the iterator will no longer be valid after this operation. The client should always call php_iterator::done before trying to access data at the new iterator position. The ignore parameter just indicates that this is a postfix expression. 72 | 73 |

74 |


75 |
76 | Andrew Bosworth 77 | 2008-03-24 78 |
79 | 80 | 81 | -------------------------------------------------------------------------------- /docs/www/node57.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | php_iterator::operator++ 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 31 | next 33 | 35 | up 37 | 39 | previous 41 | 43 | contents 45 |
46 | Next: php_iterator::size 48 | Up: Function Reference 50 | Previous: php_iterator::operator- 52 |   Contents 54 |
55 |
56 | 57 | 58 |

59 | php_iterator::operator++ 60 |

61 | 62 |

63 |

64 | #include "php_arr.h"
65 | 
66 | void 
67 | php_iterator::operator++(int ignore);
68 | 
69 | 70 |

71 | Description: Move the iterator to the next element in the php_array. If it was previously on the last element the iterator will no longer be valid after this operation. The client should always call php_iterator::done before trying to access data at the new iterator position. The ignore parameter just indicates that this is a postfix expression. 72 | 73 |

74 |


75 |
76 | Andrew Bosworth 77 | 2008-03-24 78 |
79 | 80 | 81 | -------------------------------------------------------------------------------- /docs/www/node58.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | php_iterator::size 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 31 | next 33 | 35 | up 37 | 39 | previous 41 | 43 | contents 45 |
46 | Next: php_ret 48 | Up: Function Reference 50 | Previous: php_iterator::operator++ 52 |   Contents 54 |
55 |
56 | 57 | 58 |

59 | php_iterator::size 60 |

61 | 62 |

63 |

64 | #include "php_arr.h"
65 | 
66 | int 
67 | php_iterator::size();
68 | 
69 | 70 |

71 | Description: Return the number of elements in the php_array associated with this iterator. 72 | 73 |

74 |


75 |
76 | Andrew Bosworth 77 | 2008-03-24 78 |
79 | 80 | 81 | -------------------------------------------------------------------------------- /docs/www/node59.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | php_ret 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 31 | next 33 | 35 | up 37 | 39 | previous 41 | 43 | contents 45 |
46 | Next: php_stl 48 | Up: Function Reference 50 | Previous: php_iterator::size 52 |   Contents 54 |
55 |
56 | 57 | 58 |

59 | php_ret 60 |

61 | 62 |

63 |

64 | #include "php_cxx.h"
65 | 
66 | #define SUCCESS 0
67 | #define FAIL 1
68 | 
69 | typedef unsigned int php_ret;
70 | 
71 | 72 |

73 | Description: This type is an unsigned integer value which represents a failure when given a nonzero value. 74 | 75 |

76 |


77 |
78 | Andrew Bosworth 79 | 2008-03-24 80 |
81 | 82 | 83 | -------------------------------------------------------------------------------- /docs/www/node6.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | Usage 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 31 | next 33 | 35 | up 37 | 39 | previous 41 | 43 | contents 45 |
46 | Next: Initializing 48 | Up: PHPEmbed 50 | Previous: Installation 52 |   Contents 54 |
55 |
56 | 57 | 58 |

59 | Usage 60 |

61 | 62 |

63 | This section walks through a simple (and tragically pointless) application to demonstrate common usage of the PHPEmbed library. This example will work specifically with the php_stl object since it includes all the functionality in the library, but using the php object (which doesn't use the STL) would work similarly. References to specific functions or code will be typeset in courier font. Additionally, please note that going forward references to the PHPEmbed libraries and their specific instances will be indicated by lowercase courier font (php) and the actual programming language, code written in that language, and the interpreter for that language will be indicated with normal upper case font (PHP). So, for example, php functions are the member methods belonging to the php class written in C++ and defined in php_cxx.h while PHP functions are methods written in the PHP programming language and evaluated by the PHP interpreter. 64 | 65 |

66 |


67 | 68 | Subsections 69 | 70 | 84 | 85 |

86 |
87 | Andrew Bosworth 88 | 2008-03-24 89 |
90 | 91 | 92 | -------------------------------------------------------------------------------- /docs/www/node60.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | php_stl 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 31 | next 33 | 35 | up 37 | 39 | previous 41 | 43 | contents 45 |
46 | Next: php_stl::call_bool_vector 48 | Up: Function Reference 50 | Previous: php_ret 52 |   Contents 54 |
55 |
56 | 57 | 58 |

59 | php_stl 60 |

61 | 62 |

63 |

64 | #include "php_stl.h"
65 | 
66 | class php_stl : public php {
67 | public:
68 |   php(bool type_warnings = false);
69 |   ~php();
70 |   ...
71 | };
72 | 
73 | 74 |

75 | Description: The php_stl object extends the basic php object and provides support for Standard Template Library (STL) types in addition to all the basic php functionality. The type_warnings value is optional and defaults to false If set to true the interpreter will send a string to the error function (see php::set_error_function) when it is forced to convert a value into the required type for the given STL data structure. 76 | 77 |

78 | Errors: Any errors during initialization will result in the status flag (see php::status) being set to a nonzero value. 79 | 80 |

81 |


82 |
83 | Andrew Bosworth 84 | 2008-03-24 85 |
86 | 87 | 88 | -------------------------------------------------------------------------------- /docs/www/node61.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | php_stl::call_bool_vector 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 31 | next 33 | 35 | up 37 | 39 | previous 41 | 43 | contents 45 |
46 | Next: php_stl::call_double_set 48 | Up: Function Reference 50 | Previous: php_stl 52 |   Contents 54 |
55 |
56 | 57 | 58 |

59 | php_stl::call_bool_vector 60 |

61 | 62 |

63 |

 64 | #include "php_stl.h"
 65 | 
 66 | vector<bool> 
 67 | php_stl::call_bool_vector(char *fn, char *argspec = "", ...);
 68 | 
69 | 70 |

71 | Description: Call the PHP function fn with the arguments described by argspec and included as subsequent arguments. If argspec is not specified the function will be called without any arguments. The type of the value returned from PHP must be an array and the values in that array will be pushed in order onto an STL vector of type bool. Each time it is necessary to convert a value in the array to a bool it may generate a type mismatch warning if those warnings are enabled. 72 | 73 |

74 | Errors: It is an error for the number of arguments described in argspec to differ from the number of arguments provided thereafter. It is an error for the types of additional arguments to differ from their description in argspec(see Table 1 on page [*] for details). If the value returned by PHP is not an array call_bool_vector will output a type mismatch error (regardless of whether type warnings are on or not) and return an empty vector. Any internal errors during execution will result in the status flag (see php::status) being set to a nonzero value. 76 | 77 |

78 |


79 | 80 | 82 | next 84 | 86 | up 88 | 90 | previous 92 | 94 | contents 96 |
97 | Next: php_stl::call_double_set 99 | Up: Function Reference 101 | Previous: php_stl 103 |   Contents 105 | 106 |
107 | Andrew Bosworth 108 | 2008-03-24 109 |
110 | 111 | 112 | -------------------------------------------------------------------------------- /docs/www/node62.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | php_stl::call_double_set 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 31 | next 33 | 35 | up 37 | 39 | previous 41 | 43 | contents 45 |
46 | Next: php_stl::call_double_vector 48 | Up: Function Reference 50 | Previous: php_stl::call_bool_vector 52 |   Contents 54 |
55 |
56 | 57 | 58 |

59 | php_stl::call_double_set 60 |

61 | 62 |

63 |

 64 | #include "php_stl.h"
 65 | 
 66 | set<double> 
 67 | php_stl::call_double_set(char *fn, char *argspec = "", ...);
 68 | 
69 | 70 |

71 | Description: Call the PHP function fn with the arguments described by argspec and included as subsequent arguments. If argspec is not specified the function will be called without any arguments. The type of the value returned from PHP must be an array and the values in that array will be inserted into an STL set of type double. Each time it is necessary to convert a value in the array to a double it may generate a type mismatch warning if those warnings are enabled. 72 | 73 |

74 | Errors: It is an error for the number of arguments described in argspec to differ from the number of arguments provided thereafter. It is an error for the types of additional arguments to differ from their description in argspec(see Table 1 on page [*] for details). If the value returned by PHP is not an array call_double_set will output a type mismatch error (regardless of whether type warnings are on or not) and return an empty set. Any internal errors during execution will result in the status flag (see php::status) being set to a nonzero value. 76 | 77 |

78 |


79 | 80 | 82 | next 84 | 86 | up 88 | 90 | previous 92 | 94 | contents 96 |
97 | Next: php_stl::call_double_vector 99 | Up: Function Reference 101 | Previous: php_stl::call_bool_vector 103 |   Contents 105 | 106 |
107 | Andrew Bosworth 108 | 2008-03-24 109 |
110 | 111 | 112 | -------------------------------------------------------------------------------- /docs/www/node76.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | php_stl::call_long_set 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 31 | next 33 | 35 | up 37 | 39 | previous 41 | 43 | contents 45 |
46 | Next: php_stl::call_long_string_hash_map 48 | Up: Function Reference 50 | Previous: php_stl::call_long_long_map 52 |   Contents 54 |
55 |
56 | 57 | 58 |

59 | php_stl::call_long_set 60 |

61 | 62 |

63 |

 64 | #include "php_stl.h"
 65 | 
 66 | set<long> 
 67 | php_stl::call_long_set(char *fn, char *argspec = "", ...);
 68 | 
69 | 70 |

71 | Description: Call the PHP function fn with the arguments described by argspec and included as subsequent arguments. If argspec is not specified the function will be called without any arguments. The type of the value returned from PHP must be an array and the values in that array will be inserted into an STL set of type long. Each time it is necessary to convert a value in the array to a long it may generate a type mismatch warning if those warnings are enabled. 72 | 73 |

74 | Errors: It is an error for the number of arguments described in argspec to differ from the number of arguments provided thereafter. It is an error for the types of additional arguments to differ from their description in argspec(see Table 1 on page [*] for details). If the value returned by PHP is not an array call_long_set will output a type mismatch error (regardless of whether type warnings are on or not) and return an empty set. Any internal errors during execution will result in the status flag (see php::status) being set to a nonzero value. 76 | 77 |

78 |


79 | 80 | 82 | next 84 | 86 | up 88 | 90 | previous 92 | 94 | contents 96 |
97 | Next: php_stl::call_long_string_hash_map 99 | Up: Function Reference 101 | Previous: php_stl::call_long_long_map 103 |   Contents 105 | 106 |
107 | Andrew Bosworth 108 | 2008-03-24 109 |
110 | 111 | 112 | -------------------------------------------------------------------------------- /docs/www/node81.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | php_stl::call_long_vector 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 31 | next 33 | 35 | up 37 | 39 | previous 41 | 43 | contents 45 |
46 | Next: php_stl::call_string 48 | Up: Function Reference 50 | Previous: php_stl::call_long_uint_map 52 |   Contents 54 |
55 |
56 | 57 | 58 |

59 | php_stl::call_long_vector 60 |

61 | 62 |

63 |

 64 | #include "php_stl.h"
 65 | 
 66 | vector<long> 
 67 | php_stl::call_long_vector(char *fn, char *argspec = "", ...);
 68 | 
69 | 70 |

71 | Description: Call the PHP function fn with the arguments described by argspec and included as subsequent arguments. If argspec is not specified the function will be called without any arguments. The type of the value returned from PHP must be an array and the values in that array will be pushed in order onto an STL vector of type long. Each time it is necessary to convert a value in the array to a long it may generate a type mismatch warning if those warnings are enabled. 72 | 73 |

74 | Errors: It is an error for the number of arguments described in argspec to differ from the number of arguments provided thereafter. It is an error for the types of additional arguments to differ from their description in argspec(see Table 1 on page [*] for details). If the value returned by PHP is not an array call_long_vector will output a type mismatch error (regardless of whether type warnings are on or not) and return an empty vector. Any internal errors during execution will result in the status flag (see php::status) being set to a nonzero value. 76 | 77 |

78 |


79 | 80 | 82 | next 84 | 86 | up 88 | 90 | previous 92 | 94 | contents 96 |
97 | Next: php_stl::call_string 99 | Up: Function Reference 101 | Previous: php_stl::call_long_uint_map 103 |   Contents 105 | 106 |
107 | Andrew Bosworth 108 | 2008-03-24 109 |
110 | 111 | 112 | -------------------------------------------------------------------------------- /docs/www/node82.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | php_stl::call_string 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 31 | next 33 | 35 | up 37 | 39 | previous 41 | 43 | contents 45 |
46 | Next: php_stl::call_string_bool_hash_map 48 | Up: Function Reference 50 | Previous: php_stl::call_long_vector 52 |   Contents 54 |
55 |
56 | 57 | 58 |

59 | php_stl::call_string 60 |

61 | 62 |

63 |

64 | #include "php_stl.h"
65 | 
66 | string 
67 | php_stl::call_string(char *fn, char *argspec = "", ...);
68 | 
69 | 70 |

71 | Description: Call the PHP function fn with the arguments described by argspec and included as subsequent arguments. If argspec is not specified the function will be called without any arguments. The value returned by PHP will be interpreted as a string. If type conversion is necessary it may generate a type mismatch warning if those warnings are enabled. 72 | 73 |

74 | Errors: It is an error for the number of arguments described in argspec to differ from the number of arguments provided thereafter. It is an error for the types of additional arguments to differ from their description in argspec(see Table 1 on page [*] for details). Any internal errors during execution will result in the status flag (see php::status) being set to a nonzero value. 76 | 77 |

78 |


79 |
80 | Andrew Bosworth 81 | 2008-03-24 82 |
83 | 84 | 85 | -------------------------------------------------------------------------------- /docs/www/phpembed.css: -------------------------------------------------------------------------------- 1 | /* Century Schoolbook font is very similar to Computer Modern Math: cmmi */ 2 | .MATH { font-family: "Century Schoolbook", serif; } 3 | .MATH I { font-family: "Century Schoolbook", serif; font-style: italic } 4 | .BOLDMATH { font-family: "Century Schoolbook", serif; font-weight: bold } 5 | 6 | /* implement both fixed-size and relative sizes */ 7 | SMALL.XTINY { font-size : xx-small } 8 | SMALL.TINY { font-size : x-small } 9 | SMALL.SCRIPTSIZE { font-size : smaller } 10 | SMALL.FOOTNOTESIZE { font-size : small } 11 | SMALL.SMALL { } 12 | BIG.LARGE { } 13 | BIG.XLARGE { font-size : large } 14 | BIG.XXLARGE { font-size : x-large } 15 | BIG.HUGE { font-size : larger } 16 | BIG.XHUGE { font-size : xx-large } 17 | 18 | /* heading styles */ 19 | H1 { } 20 | H2 { } 21 | H3 { } 22 | H4 { } 23 | H5 { } 24 | 25 | /* mathematics styles */ 26 | DIV.displaymath { } /* math displays */ 27 | TD.eqno { } /* equation-number cells */ 28 | 29 | 30 | /* document-specific styles come next */ 31 | -------------------------------------------------------------------------------- /examples/Makefile.am: -------------------------------------------------------------------------------- 1 | # Automake input file. 2 | # $Id$ 3 | 4 | # Includes paths 5 | INCLUDES = -I. 6 | INCLUDES += @PHPCONFIGINCLUDES@ 7 | INCLUDES += -I$(top_srcdir)/src 8 | 9 | # Paths to installed libraries 10 | AM_LDFLAGS = @PHPCONFIGLDFLAGS@ 11 | 12 | # List of libraries to link with. 13 | LDADD = @PHPCONFIGLIBS@ $(top_builddir)/src/libphpembed.la -lphp5 14 | 15 | bin_PROGRAMS = test usage example 16 | test_SOURCES = test.cpp 17 | usage_SOURCES = usage.cpp 18 | example_SOURCES = example.cpp 19 | 20 | -------------------------------------------------------------------------------- /examples/example.cpp: -------------------------------------------------------------------------------- 1 | // PHP EMBED example program 2 | // Copyright (c) 2007 Andrew Bosworth, Facebook, inc 3 | // Modified by Dmitry Zenovich 4 | // All rights reserved 5 | 6 | #include "php_stl.h" 7 | 8 | // prototype 9 | void print_php_array(php_array &a, int depth = 0); 10 | 11 | // define our own output functions with this exact signature 12 | void print_null(const char *str) {} 13 | void print_mine(const char *str){ 14 | printf("%s", str); 15 | } 16 | 17 | int main(int argc, char **argv){ 18 | 19 | // Instantiate the object, set type_warnings to true 20 | php_stl p(true); 21 | 22 | // Load a php file 23 | if(SUCCESS != p.load("example.php")){ 24 | printf("load failed\n"); 25 | return 1; 26 | } 27 | 28 | // redefine the output functions to do what we want 29 | p.set_message_function(print_null); 30 | p.set_output_function(print_mine); 31 | 32 | // an example of calling into a function with C arguments 33 | long tre = 3; 34 | char *tres = p.call_c_string("trivial_func", "sld", "answer: ", tre, 4.5); 35 | if(tres){ 36 | printf("%s\n", tres); 37 | free(tres); 38 | } 39 | printf("\n"); 40 | 41 | // this test function returns a string, but we call_long so it converts it 42 | // to a long value. Since I have instantiated this php object with the 43 | // type_warnings parameter to true, this will output an error. If you do NOT 44 | // want an error message, just omit the argument or set it to false. You can 45 | // redirect this error output by using set_error_function 46 | long hit = p.call_long("test"); 47 | printf("long value: %ld\n", hit); 48 | printf("\n"); 49 | 50 | // redirect error output to null 51 | p.set_error_function(print_null); 52 | 53 | // convert a php string array to a vector of longs 54 | vector blah = p.call_long_vector("blah"); 55 | for(vector::iterator it = blah.begin(); it != blah.end(); it++){ 56 | printf("%ld\n", *it); 57 | } 58 | printf("\n"); 59 | 60 | // get a nested array back from php 61 | php_array *a = p.call_php_array("foo_complex_array"); 62 | 63 | // use our function below with iterators and type checking to print it in C 64 | print_php_array(*a); 65 | printf("\n"); 66 | 67 | // now try printing it with PHP, should use our output function from above 68 | p.call_void("print_r", "a", a); 69 | 70 | delete a; 71 | } 72 | 73 | 74 | void print_php_array(php_array &a, int depth){ 75 | php_iterator it(a); 76 | 77 | for(int i = 0; i < depth; i++) 78 | printf(" "); 79 | printf("%d elements\n", it.size()); 80 | 81 | while(!it.done()){ 82 | 83 | for(int i = 0; i < depth; i++) 84 | printf(" "); 85 | 86 | char *str; 87 | switch(it.get_key_type()){ 88 | case IS_LONG: 89 | printf("long %ld => ", it.get_key_long()); 90 | break; 91 | case IS_STRING: 92 | printf("string %s => ", str = it.get_key_c_string()); 93 | free(str); 94 | break; 95 | default: 96 | printf("??? %s => ", str = it.get_key_c_string()); 97 | free(str); 98 | break; 99 | } 100 | 101 | switch(it.get_data_type()){ 102 | case IS_LONG: 103 | printf("long %ld\n", it.get_data_long()); 104 | break; 105 | case IS_STRING: 106 | printf("string %s\n", str = it.get_data_c_string()); 107 | free(str); 108 | break; 109 | case IS_DOUBLE: 110 | printf("double %f\n", it.get_data_double()); 111 | break; 112 | case IS_BOOL: 113 | printf("bool %s\n", str = it.get_data_c_string()); 114 | free(str); 115 | break; 116 | case IS_ARRAY: 117 | printf("Array\n"); 118 | { 119 | php_array t = it.get_data_array(); 120 | print_php_array(t, depth + 1); 121 | } 122 | break; 123 | default: 124 | printf("??? %s\n", str = it.get_data_c_string()); 125 | free(str); 126 | break; 127 | } 128 | 129 | it++; 130 | } 131 | } 132 | -------------------------------------------------------------------------------- /examples/example.php: -------------------------------------------------------------------------------- 1 | 1), 2 => "2"), array("x" => 3.14), 4 => false)); 18 | } 19 | 20 | function test(){ 21 | return '35'; 22 | } 23 | 24 | function blah(){ 25 | return array('10', '20', '30'); 26 | } 27 | 28 | ?> 29 | -------------------------------------------------------------------------------- /examples/test.php: -------------------------------------------------------------------------------- 1 | 6 | // All rights reserved 7 | // 8 | // This file is loaded by the PHP interpreter compiled into test 9 | 10 | // we set a larger memory limit just in case 11 | ini_set('memory_limit', '100M'); 12 | 13 | function foo_void(){ 14 | echo "passed.\n"; 15 | ob_flush(); 16 | return; 17 | } 18 | 19 | function foo_long(){ 20 | return 3; 21 | } 22 | 23 | function foo_bool(){ 24 | return true; 25 | } 26 | 27 | function foo_double(){ 28 | return 3.14; 29 | } 30 | 31 | function foo_string(){ 32 | return "hello world\n"; 33 | } 34 | 35 | function foo_string_ex(){ 36 | return "hello \0world\n"; 37 | } 38 | 39 | function foo_vector_long(){ 40 | return array(2, 3, 4, 3); 41 | } 42 | 43 | function foo_vector_bool(){ 44 | return array(true, false, true); 45 | } 46 | 47 | function foo_vector_double(){ 48 | return array(2.71, 3.14, 4.0, 3.14); 49 | } 50 | 51 | function foo_vector_string(){ 52 | return array("two", "three", "four\0\1", "three"); 53 | } 54 | 55 | function foo_assoc_string(){ 56 | return array("two" => "dos", "three" => "tres", "four\0\1" => "quatro\0\1"); 57 | } 58 | 59 | function foo_assoc_double(){ 60 | return array("two" => 2.71, "three" => 3.14, "four\0\1" => 4.0, "five" => 3.14); 61 | } 62 | 63 | function foo_assoc_long(){ 64 | return array("two" => 2, "three" => 3, "four\0\1" => 4, "five" => 3); 65 | } 66 | 67 | function foo_assoc_bool(){ 68 | return array("two" => true, "three" => false, "four\0\1" => true); 69 | } 70 | 71 | function foo_index_string(){ 72 | return array(2 => "two", 3 => "three", 4 => "four\0\1", 5 => "three"); 73 | } 74 | 75 | function foo_index_double(){ 76 | return array(2 => 2.71, 3 => 3.14, 4 => 4.0, 5 => 3.14); 77 | } 78 | 79 | function foo_index_long(){ 80 | return array(2 => 2, 3 => 3, 4 => 4, 6 => 6); 81 | } 82 | 83 | function foo_index_bool(){ 84 | return array(2 => true, 3 => false, 4 => true); 85 | } 86 | 87 | function foo_complex_array(){ 88 | return array(array(array("1" => 1),2 => "2"), array("x" => 3.14), 4 => false, "a\0.\0.a" => "b\0.\0.b\1"); 89 | } 90 | 91 | function bar($l, $d, $c, $b, $i, $u, $s){ 92 | return($l == 2 && $d == 3.14 && $c == 'four' && $b && $i == 5 && $u == 6 && $s == "a.\0.\0.a"); 93 | } 94 | 95 | function verify_assoc($a){ 96 | 97 | if(!isset($a["a"]) || !isset($a["bee"]) || !isset($a["cee\0\1"])) 98 | return false; 99 | 100 | $first = $a["a"]; 101 | $second = $a["bee"]; 102 | $third = $a["cee\0\1"]; 103 | 104 | return($first == 1 && $second == "tw\0\1" && $third == 3); 105 | } 106 | 107 | function verify_index($a){ 108 | return(isset($a[5]) && isset($a[2]) && isset($a[10]) && $a[5] == "one" && $a[2] == "abc" && $a[10] == 2.71); 109 | } 110 | 111 | function verify_mixed($a){ 112 | return(isset($a[5]) && isset($a[2]) && isset($a[10]) && isset($a["what"]) && 113 | $a[5] == "one" && $a[2] == "abc" && $a[10] == 2.71 && $a["what"] == "yo"); 114 | } 115 | 116 | function verify_enum($a){ 117 | return(isset($a[5]) && isset($a[2]) && isset($a[10]) && isset($a["what"]) && isset($a[11]) && 118 | $a[5] == "one" && $a[2] == "abc" && $a[10] == 2.71 && $a["what"] == "yo" && 119 | $a[11] == 2.1413); 120 | } 121 | 122 | function verify_nested($a){ 123 | return(verify_assoc($a[0]) && verify_enum($a[1])); 124 | } 125 | 126 | function verify_remove($a, $b){ 127 | if(isset($a["a"]) || isset($b[5]) || isset($a["cee\0\1"])) 128 | return false; 129 | 130 | if(!isset($a["bee"]) || !isset($b[2]) || !isset($b[10]) || !isset($b[11])) 131 | return false; 132 | 133 | $first = $a["bee"]; 134 | return($first == "tw\0\1" && $b[2] == "abc" && $b[10] == 2.71 && $b[11] == 2.1413); 135 | } 136 | ?> 137 | -------------------------------------------------------------------------------- /examples/usage.cpp: -------------------------------------------------------------------------------- 1 | // PHP EMBED tutorial program 2 | // Copyright (c) 2007 Andrew Bosworth, Facebook, inc 3 | // Modified by Dmitry Zenovich 4 | // All rights reserved 5 | 6 | #include "php_stl.h" 7 | 8 | // define our own output functions with this exact signature 9 | void print_null(const char *str) {} 10 | void print_mine(const char *str){ printf("%s", str); } 11 | 12 | int main(int argc, char **argv){ 13 | 14 | // Instantiate the object without type warnings 15 | php_stl p; 16 | 17 | // redefine the output functions to do what we want 18 | p.set_message_function(print_null); 19 | p.set_output_function(print_mine); 20 | 21 | long memused = p.call_long("memory_get_usage"); 22 | hash_set ex; 23 | ex = p.call_string_hash_set("get_loaded_extensions"); 24 | 25 | printf("memused = %ldb\n", memused); 26 | 27 | char *one = "test1"; 28 | int comp = 4; 29 | long match = p.call_long("strncmp", "ssi", one, "test2", comp); 30 | 31 | printf("match = %ld (should be 0)\n", match); 32 | 33 | php_array a; 34 | php_array b(a); 35 | 36 | a.add("l", 5); 37 | a.add_assoc("slsd", "one", 1, "two", 2.5); 38 | a.add_index("lsll", 6, "six", 128, 129); 39 | 40 | a.remove(6); 41 | a.remove("two"); 42 | 43 | p.call_void("print_r", "a", &a); 44 | 45 | php_iterator it(a); 46 | 47 | int count = 0; 48 | while(!it.done()){ 49 | count++; 50 | it++; 51 | } 52 | 53 | it.go_to_end(); 54 | 55 | if(!it.done()){ 56 | switch(it.get_key_type()){ 57 | case IS_LONG: 58 | printf("long %ld => ", it.get_key_long()); 59 | break; 60 | case IS_STRING: 61 | { 62 | char *str = it.get_key_c_string(); 63 | printf("string %s => ", str); 64 | free(str); 65 | break; 66 | } 67 | default: 68 | { 69 | char *str = it.get_key_c_string(); 70 | printf("??? %s => ", it.get_key_c_string()); 71 | free(str); 72 | break; 73 | } 74 | } 75 | switch(it.get_data_type()){ 76 | case IS_LONG: 77 | printf("long %ld\n", it.get_data_long()); 78 | break; 79 | case IS_STRING: 80 | { 81 | char *str = it.get_data_c_string(); 82 | printf("string %s\n", str); 83 | free(str); 84 | break; 85 | } 86 | case IS_DOUBLE: 87 | printf("double %f\n", it.get_data_double()); 88 | break; 89 | case IS_BOOL: 90 | { 91 | char *str = it.get_data_c_string(); 92 | printf("bool %s\n", str); 93 | free(str); 94 | break; 95 | } 96 | case IS_ARRAY: 97 | printf("Array\n"); 98 | { 99 | php_array suba = it.get_data_array(); 100 | php_iterator subit(suba); 101 | // now iterate on the sub array! 102 | } 103 | break; 104 | default: 105 | { 106 | char *str = it.get_data_c_string(); 107 | printf("??? %s\n", str); 108 | free(str); 109 | break; 110 | } 111 | } 112 | } 113 | 114 | return 0; 115 | } 116 | -------------------------------------------------------------------------------- /phpembedVersion.h.in: -------------------------------------------------------------------------------- 1 | // Autoconf versioning 2 | // $Id 3 | 4 | #ifndef _PHPEMBED_VERSION_DEFINED_ 5 | #define _PHPEMBED_VERSION_DEFINED_ 6 | #define PHPEMBED_MAJOR_VERSION @PHPEMBED_MAJOR_VERSION@ 7 | #define PHPEMBED_MINOR_VERSION @PHPEMBED_MINOR_VERSION@ 8 | #define PHPEMBED_PATCH_VERSION @PHPEMBED_PATCH_VERSION@ 9 | #define PHPEMBED_VERSION_STRING @PHPEMBED_VERSION_STRING@ 10 | #endif 11 | -------------------------------------------------------------------------------- /src/Makefile.am: -------------------------------------------------------------------------------- 1 | # Automake input file. 2 | # $Id$ 3 | 4 | INCLUDES = -I. 5 | INCLUDES += @PHPCONFIGINCLUDES@ 6 | 7 | # add includes to dist. 8 | # use noinst_LTLIBRARIES to prevent -rpath inclusion during linking. 9 | libphpembed_includes = php_arr.h php_cxx.h php_stl.h php_tok_consts.h php_tok.h 10 | lib_LTLIBRARIES = libphpembed.la 11 | libphpembed_la_SOURCES = php_cxx.cpp php_arr.cpp php_stl.cpp php_tok.cpp $(libphpembed_includes) 12 | libphpembed_la_LDFLAGS = -release 4.0.0 13 | 14 | # Information about libtool shared lib versioning scheme. 15 | # libtool library versions are described by three integers: 16 | # current - The most recent interface number that this library implements. 17 | # revision - The implementation number of the current interface. 18 | # age - In other words, the library implements all the interface numbers in the range from number current - age to current. 19 | 20 | # Versioning rules 21 | # 1. Start with version information of `0:1:0' for each libtool library. 22 | # 2. If the library source code has changed at all since the last update, then increment revision (`c:r:a' becomes `c:r+1:a'). 23 | # 3. If any interfaces have been added, removed, or changed since the last update, increment current, and set revision to 0. 24 | # 4. If any interfaces have been added since the last public release, then increment age. 25 | # 5. If any interfaces have been removed since the last public release, then set age to 0. 26 | # Example: #libphpembed_la_LDFLAGS = -version-info 0:1:0 27 | -------------------------------------------------------------------------------- /src/php_stl.h: -------------------------------------------------------------------------------- 1 | // PHPEmbed STL header 2 | // Copyright (c) 2007 Andrew Bosworth, Facebook, inc 3 | // All rights reserved 4 | 5 | #ifndef PHPSTL_H 6 | #define PHPSTL_H 7 | 8 | #include "php_cxx.h" 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | using std::string; 17 | using std::set; 18 | using std::vector; 19 | using std::map; 20 | using __gnu_cxx::hash_set; 21 | using __gnu_cxx::hash_map; 22 | 23 | // define the hash method for STL strings 24 | namespace __gnu_cxx 25 | { 26 | template<> struct hash< std::string > 27 | { 28 | size_t operator()( const std::string& x ) const 29 | { 30 | return hash< const char* >()( x.c_str() ); 31 | } 32 | }; 33 | } 34 | 35 | class php_stl : public php 36 | { 37 | public: 38 | php_stl(bool type_warnings = false) : php(type_warnings) {}; 39 | ~php_stl(){}; 40 | 41 | // STL strings are more convenient than C strings 42 | string call_string(char *fn, char *argspec = "", ...); 43 | 44 | // NOTE ON INT AND UINT TYPES 45 | // these just truncate php longs into integers before insertion 46 | 47 | vector call_string_vector(char *fn, char *argspec = "", ...); 48 | vector call_double_vector(char *fn, char *argspec = "", ...); 49 | vector call_long_vector(char *fn, char *argspec = "", ...); 50 | vector call_bool_vector(char *fn, char *argspec = "", ...); 51 | vector call_int_vector(char *fn, char *argspec = "", ...); 52 | vector call_uint_vector(char *fn, char *argspec = "", ...); 53 | 54 | // a set of bools doesn't make much sense 55 | set call_string_set(char *fn, char *argspec = "", ...); 56 | set call_double_set(char *fn, char *argspec = "", ...); 57 | set call_long_set(char *fn, char *argspec = "", ...); 58 | set call_int_set(char *fn, char *argspec = "", ...); 59 | set call_uint_set(char *fn, char *argspec = "", ...); 60 | 61 | // a hash set of bools also makes no sense 62 | hash_set call_string_hash_set(char *fn, char *argspec = "", ...); 63 | hash_set call_long_hash_set(char *fn, char *argspec = "", ...); 64 | hash_set call_int_hash_set(char *fn, char *argspec = "", ...); 65 | hash_set call_uint_hash_set(char *fn, char *argspec = "", ...); 66 | 67 | // NOTE ON NESTED ARRAYS: These maps only support flat associative arrays 68 | // for nested arrays you'll need to use the php_arr class! 69 | 70 | // We only support string and long indices since that is what is in PHP 71 | map call_string_string_map(char *fn, char *argspec = "", ...); 72 | map call_string_double_map(char *fn, char *argspec = "", ...); 73 | map call_string_long_map(char *fn, char *argspec = "", ...); 74 | map call_string_bool_map(char *fn, char *argspec = "", ...); 75 | map call_string_int_map(char *fn, char *argspec = "", ...); 76 | map call_string_uint_map(char *fn, char *argspec = "", ...); 77 | map call_long_string_map(char *fn, char *argspec = "", ...); 78 | map call_long_double_map(char *fn, char *argspec = "", ...); 79 | map call_long_long_map(char *fn, char *argspec = "", ...); 80 | map call_long_bool_map(char *fn, char *argspec = "", ...); 81 | map call_long_int_map(char *fn, char *argspec = "", ...); 82 | map call_long_uint_map(char *fn, char *argspec = "", ...); 83 | 84 | hash_map call_string_string_hash_map(char *fn, char *argspec = "", ...); 85 | hash_map call_string_double_hash_map(char *fn, char *argspec = "", ...); 86 | hash_map call_string_long_hash_map(char *fn, char *argspec = "", ...); 87 | hash_map call_string_bool_hash_map(char *fn, char *argspec = "", ...); 88 | hash_map call_string_int_hash_map(char *fn, char *argspec = "", ...); 89 | hash_map call_string_uint_hash_map(char *fn, char *argspec = "", ...); 90 | hash_map call_long_string_hash_map(char *fn, char *argspec = "", ...); 91 | hash_map call_long_double_hash_map(char *fn, char *argspec = "", ...); 92 | hash_map call_long_long_hash_map(char *fn, char *argspec = "", ...); 93 | hash_map call_long_bool_hash_map(char *fn, char *argspec = "", ...); 94 | hash_map call_long_int_hash_map(char *fn, char *argspec = "", ...); 95 | hash_map call_long_uint_hash_map(char *fn, char *argspec = "", ...); 96 | }; 97 | 98 | #endif 99 | -------------------------------------------------------------------------------- /src/php_tok.h: -------------------------------------------------------------------------------- 1 | // PHP_TOKENIZER 2 | // Copyright (c) 2007 Andrew Bosworth, Facebook, inc 3 | // All rights reserved 4 | 5 | #ifndef PHPTOK_H 6 | #define PHPTOK_H 7 | 8 | #include "php_stl.h" 9 | 10 | #include "php_tok_consts.h" 11 | 12 | #include 13 | using __gnu_cxx::hash_map; 14 | 15 | // the basic token structure 16 | typedef struct{ 17 | int type; 18 | string content; 19 | } token; 20 | 21 | /* 22 | * TOKEN_CONT - a simple token container class, handles data and access 23 | */ 24 | class token_cont 25 | { 26 | public: 27 | token_cont() {}; 28 | ~token_cont() {}; 29 | 30 | // add a token to this object 31 | inline void push_back(token &t){ tokens.push_back(t); } 32 | 33 | // reset the token to the start 34 | inline void reset(){ iter = tokens.begin(); } 35 | 36 | // count the number of tokens we contain 37 | inline size_t count(){ return tokens.size(); } 38 | 39 | // return the next token pointed at by the iterator and advance it 40 | token get_next_token(){ 41 | 42 | // we are out of tokens! 43 | if(iter == tokens.end()){ 44 | token t; 45 | t.type = T_NOMORE; 46 | return t; 47 | } 48 | 49 | token t = *iter; 50 | iter++; 51 | return t; 52 | } 53 | 54 | // for debug 55 | void dump_tokens(FILE *f){ 56 | for(vector::iterator it = tokens.begin(); it != tokens.end(); it++){ 57 | fprintf(f, "%4d: %s\n", it->type, (it->content).c_str()); 58 | } 59 | } 60 | 61 | private: 62 | vector tokens; 63 | vector::iterator iter; 64 | 65 | // we could add an iterator stack here to allow users to save state for 66 | // a subroutine, but until we have an application for it lets keep it simple 67 | }; 68 | 69 | // for convenience 70 | typedef hash_map token_map; 71 | 72 | /* 73 | * PHP_TOK - a multifile PHP tokenizer class 74 | */ 75 | class php_tok : public php_stl 76 | { 77 | public: 78 | php_tok(bool bOut = true, bool bWarn = true); 79 | ~php_tok(){}; 80 | 81 | // 82 | // TOKENIZERS 83 | // 84 | 85 | // parse the given file for tokens, initialize relevant iterator 86 | // this is named after its analog in php 87 | php_ret token_get_all(const char *file); 88 | 89 | // tokenize the given file and all child includes 90 | php_ret token_get_all_recursive(const char *file); 91 | 92 | 93 | // 94 | // ACCESSORS 95 | // users can treat this class like a multimap iterator 96 | // 97 | 98 | // return a 2-D array of all the files currently tokenized 99 | // we use a vector of char* because char ** is too hard to use right 100 | vector get_tokenized_files(); 101 | 102 | // reset the iterator associated with a given file 103 | // returns false if that file isn't tokenized 104 | bool reset_iterator(const char *file); 105 | 106 | // get the number of tokens in the given file 107 | size_t count(const char *file); 108 | 109 | // gets the next token from the iterator for the specified file 110 | // returns T_NOMORE when done or if the specified file isn't tokenized 111 | token get_next_token(const char *file); 112 | 113 | // get all files included in a given file and populate the includes argument 114 | // return false if the file hasn't been tokenized yet 115 | // 116 | // NOTE: this will reset your iterator! Do this first if you need it! 117 | bool get_includes(const char *file, vector &includes); 118 | 119 | 120 | // 121 | // FOR DEBUGGING 122 | // 123 | 124 | void dump_tokens(FILE *f = stdout); 125 | 126 | private: 127 | 128 | // the map from files to token iterators (lists of tokens w/ iterators) 129 | token_map alltokens; 130 | }; 131 | 132 | #endif 133 | -------------------------------------------------------------------------------- /src/php_tok_consts.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2007 Andrew Bosworth, Facebook, inc 2 | // All rights reserved 3 | 4 | #include "zend_language_parser.h" 5 | 6 | // these aren't used by PHP, but are useful internally since we don't 7 | // have NULL and typeless nested arrays in C++. =) 8 | #define T_NOMORE 0 9 | #define T_SYNTAX 1 10 | 11 | // these defines were generated by the following php script: 12 | // 13 | // for($i = 257; $i < 376; $i++){ 14 | // printf("#define %s %d\n", token_name($i), $i); 15 | // } 16 | // 17 | #define T_REQUIRE_ONCE 258 18 | #define T_REQUIRE 259 19 | #define T_EVAL 260 20 | #define T_INCLUDE_ONCE 261 21 | #define T_INCLUDE 262 22 | #define T_LOGICAL_OR 263 23 | #define T_LOGICAL_XOR 264 24 | #define T_LOGICAL_AND 265 25 | #define T_PRINT 266 26 | #define T_SR_EQUAL 267 27 | #define T_SL_EQUAL 268 28 | #define T_XOR_EQUAL 269 29 | #define T_OR_EQUAL 270 30 | #define T_AND_EQUAL 271 31 | #define T_MOD_EQUAL 272 32 | #define T_CONCAT_EQUAL 273 33 | #define T_DIV_EQUAL 274 34 | #define T_MUL_EQUAL 275 35 | #define T_MINUS_EQUAL 276 36 | #define T_PLUS_EQUAL 277 37 | #define T_BOOLEAN_OR 278 38 | #define T_BOOLEAN_AND 279 39 | #define T_IS_NOT_IDENTICAL 280 40 | #define T_IS_IDENTICAL 281 41 | #define T_IS_NOT_EQUAL 282 42 | #define T_IS_EQUAL 283 43 | #define T_IS_GREATER_OR_EQUAL 284 44 | #define T_IS_SMALLER_OR_EQUAL 285 45 | #define T_SR 286 46 | #define T_SL 287 47 | #define T_INSTANCEOF 288 48 | #define T_UNSET_CAST 289 49 | #define T_BOOL_CAST 290 50 | #define T_OBJECT_CAST 291 51 | #define T_ARRAY_CAST 292 52 | #define T_STRING_CAST 293 53 | #define T_DOUBLE_CAST 294 54 | #define T_INT_CAST 295 55 | #define T_DEC 296 56 | #define T_INC 297 57 | #define T_CLONE 298 58 | #define T_NEW 299 59 | #define T_EXIT 300 60 | #define T_IF 301 61 | #define T_ELSEIF 302 62 | #define T_ELSE 303 63 | #define T_ENDIF 304 64 | #define T_LNUMBER 305 65 | #define T_DNUMBER 306 66 | #define T_STRING 307 67 | #define T_STRING_VARNAME 308 68 | #define T_VARIABLE 309 69 | #define T_NUM_STRING 310 70 | #define T_INLINE_HTML 311 71 | #define T_CHARACTER 312 72 | #define T_BAD_CHARACTER 313 73 | #define T_ENCAPSED_AND_WHITESPACE 314 74 | #define T_CONSTANT_ENCAPSED_STRING 315 75 | #define T_ECHO 316 76 | #define T_DO 317 77 | #define T_WHILE 318 78 | #define T_ENDWHILE 319 79 | #define T_FOR 320 80 | #define T_ENDFOR 321 81 | #define T_FOREACH 322 82 | #define T_ENDFOREACH 323 83 | #define T_DECLARE 324 84 | #define T_ENDDECLARE 325 85 | #define T_AS 326 86 | #define T_SWITCH 327 87 | #define T_ENDSWITCH 328 88 | #define T_CASE 329 89 | #define T_DEFAULT 330 90 | #define T_BREAK 331 91 | #define T_CONTINUE 332 92 | #define T_FUNCTION 333 93 | #define T_CONST 334 94 | #define T_RETURN 335 95 | #define T_TRY 336 96 | #define T_CATCH 337 97 | #define T_THROW 338 98 | #define T_USE 339 99 | #define T_GLOBAL 340 100 | #define T_PUBLIC 341 101 | #define T_PROTECTED 342 102 | #define T_PRIVATE 343 103 | #define T_FINAL 344 104 | #define T_ABSTRACT 345 105 | #define T_STATIC 346 106 | #define T_VAR 347 107 | #define T_UNSET 348 108 | #define T_ISSET 349 109 | #define T_EMPTY 350 110 | #define T_HALT_COMPILER 351 111 | #define T_CLASS 352 112 | #define T_INTERFACE 353 113 | #define T_EXTENDS 354 114 | #define T_IMPLEMENTS 355 115 | #define T_OBJECT_OPERATOR 356 116 | #define T_DOUBLE_ARROW 357 117 | #define T_LIST 358 118 | #define T_ARRAY 359 119 | #define T_CLASS_C 360 120 | #define T_METHOD_C 361 121 | #define T_FUNC_C 362 122 | #define T_LINE 363 123 | #define T_FILE 364 124 | #define T_COMMENT 365 125 | #define T_DOC_COMMENT 366 126 | #define T_OPEN_TAG 367 127 | #define T_OPEN_TAG_WITH_ECHO 368 128 | #define T_CLOSE_TAG 369 129 | #define T_WHITESPACE 370 130 | #define T_START_HEREDOC 371 131 | #define T_END_HEREDOC 372 132 | #define T_DOLLAR_OPEN_CURLY_BRACES 373 133 | #define T_CURLY_OPEN 374 134 | #define T_DOUBLE_COLON 375 135 | --------------------------------------------------------------------------------