Git Product home page Git Product logo

hello-php-extension's Introduction

Compile

phpize
./configure --enable-hello
make

Tutorial 1

http://devzone.zend.com/303/extension-writing-part-i-introduction-to-php-and-zend/

Run

php -c php.ini -r "echo hello_world();"
Hello World

php -c php.ini -r "var_dump( hello_bool() );"
bool(true)

php -c php.ini -r "echo hello_long();"
42

php -c php.ini -r "echo hello_double();"
3.1415926535

php -c php.ini -r "var_dump( hello_null() );"
NULL

Tutorial 2

http://devzone.zend.com/317/extension-writing-part-ii-parameters-arrays-and-zvals/ http://devzone.zend.com/318/extension-writing-part-ii-parameters-arrays-and-zvals-continued/

php -c php.ini -r "hello_greetme('Joe');"
Hello Joe

php -c php.ini -r "echo hello_add(2, 4.1);"
6.1

php -c php.ini -r "echo hello_add(2, 4.1, true);"
6

php -c php.ini -r "var_dump(hello_array());"

array(6) {
  [42]=>
  int(123)
  [43]=>
  string(33) "I should now be found at index 43"
  [44]=>
  string(10) "I'm at 44!"
  [45]=>
  string(10) "Forty Five"
  ["pi"]=>
  float(3.1415926535)
  ["subarray"]=>
  array(1) {
    [0]=>
    string(5) "hello"
  }
}

Show hello_array_strings:

<?php
$a = array('foo', 123);
var_dump($a);
hello_array_strings($a);
var_dump($a);

Working with $GLOBALS:

<?php
$GLOBALS['test'] = 'Joe';
echo hello_get_global_var('test');
echo hello_get_global_var('none');

Setting local variables:

<?php
hello_set_local_var('test', 'Greetings');
echo "$test\n";

Tutorial 3

http://devzone.zend.com/446/extension-writing-part-iii-resources/

Resources

<?php

$person = hello_person_new("Joseph", 31);
var_dump($person);

hello_person_greet($person);

hello-php-extension's People

Contributors

jheth avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

hello-php-extension's Issues

error

PHP Warning: PHP Startup: Unable to load dynamic library 'modules/hello.so' - modules/hello.so: cannot open shared object file: No such file or directory in Unknown on line 0

Fatal error: Uncaught Error: Call to undefined function hello_world() in Command line code:1
Stack trace:
#0 {main}
thrown in Command line code on line 1

Windows

Hi,

Can you tell me the way to compile this one for Apache2.4 ( for windows ) ?

Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.