gophp

package module
v1.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 16, 2023 License: MIT Imports: 6 Imported by: 3

README

gophp

Build Status

Golang implementation for PHP's functions

Install / Update

go get -u github.com/leeqvip/gophp

Example

package main

import (
	"fmt"

	"github.com/leeqvip/gophp"
)

func main() {

	str := `a:1:{s:3:"php";s:24:"世界上最好的语言";}`

	// unserialize() in php
	out, _ := gophp.Unserialize([]byte(str))

	fmt.Println(out) //map[php:世界上最好的语言]

	// serialize() in php
	jsonbyte, _ := gophp.Serialize(out)

	fmt.Println(string(jsonbyte)) // a:1:{s:3:"php";s:24:"世界上最好的语言";}

}

License

This project is licensed under the MIT license.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ArrayKeys added in v1.0.0

func ArrayKeys(array map[string]interface{}) []string

ArrayKeys Return all the keys or a subset of the keys of an array

func Implode added in v1.0.0

func Implode(separator string, array []string) string

Implode Join array elements with a string

func IsArray added in v1.0.0

func IsArray(v interface{}) bool

IsArray Finds whether a variable is an array

func Md5 added in v1.0.0

func Md5(str string) string

Md5 Calculate the md5 hash of a string

func Serialize added in v1.0.0

func Serialize(value interface{}) ([]byte, error)

Serialize Generates a storable representation of a value

func Strtolower added in v1.0.0

func Strtolower(str string) string

Strtolower Make a string lowercase

func Strtoupper added in v1.0.0

func Strtoupper(str string) string

Strtoupper Make a string uppercase

func Unserialize added in v1.0.0

func Unserialize(data []byte) (interface{}, error)

Unserialize Creates a PHP value from a stored representation

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL