mirror of
https://github.com/dunglas/frankenphp.git
synced 2025-12-24 13:38:11 +08:00
committed by
GitHub
parent
225ca409d3
commit
599c92b15d
32
testdata/integration/basic_function.go
vendored
Normal file
32
testdata/integration/basic_function.go
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
package testintegration
|
||||
|
||||
// #include <Zend/zend_types.h>
|
||||
import "C"
|
||||
import (
|
||||
"strings"
|
||||
"unsafe"
|
||||
|
||||
"github.com/dunglas/frankenphp"
|
||||
)
|
||||
|
||||
// export_php:function test_uppercase(string $str): string
|
||||
func test_uppercase(s *C.zend_string) unsafe.Pointer {
|
||||
str := frankenphp.GoString(unsafe.Pointer(s))
|
||||
upper := strings.ToUpper(str)
|
||||
return frankenphp.PHPString(upper, false)
|
||||
}
|
||||
|
||||
// export_php:function test_add_numbers(int $a, int $b): int
|
||||
func test_add_numbers(a int64, b int64) int64 {
|
||||
return a + b
|
||||
}
|
||||
|
||||
// export_php:function test_multiply(float $a, float $b): float
|
||||
func test_multiply(a float64, b float64) float64 {
|
||||
return a * b
|
||||
}
|
||||
|
||||
// export_php:function test_is_enabled(bool $flag): bool
|
||||
func test_is_enabled(flag bool) bool {
|
||||
return !flag
|
||||
}
|
||||
Reference in New Issue
Block a user