Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Perl and PHP

by tobyink (Canon)
on Dec 10, 2012 at 22:32 UTC ( [id://1008175]=note: print w/replies, xml ) Need Help??


in reply to Perl and PHP

An embedded Perl interpreter for PHP does exist but it's a pretty bizarro thing to do.

Update: the following works here:

<?php $perl = new Perl(); $perl->eval(<<<'PERL' sub add_two { my $n = shift; return $n + 2; } PERL ); echo "add_two(3) is ... ", $perl->add_two(3), "\n";

Interestingly when running print "$^X $]" in the embedded Perl, I get: /usr/bin/php 5.010001 (that version number happens to correspond to my operating system's pre-packaged version of Perl).

perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1008175]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (2)
As of 2024-04-26 05:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found