3

php和go对比

 2 years ago
source link: https://zsmhub.github.io/post/%E9%9D%A2%E8%AF%95%E5%BF%85%E5%A4%87/php%E5%92%8Cgo%E5%AF%B9%E6%AF%94/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

php 优缺点

  • php 支持泛型
  • php 支持 in_array
  • php 同个函数的数组返回值,key可以随意变化

缺点,可维护性差

  • 数据类型没有强制要求提前声明,同个变量可以支持多种数据类型的值
  • 关联数组字段没有声明,不清楚该关联数组有哪些字段
  • 服务器部署 php 项目代码占用的资源更多

go 优缺点

  • 数据类型强声明,可以很清晰的知道每个 MAP 包含哪些字段
  • 底层支持协程,异步简单易用
  • go 同个函数的数组返回值,key是固定的,比较规范
  • 服务器部署 go 项目代码占用的资源较小
  • 暂不支持泛型
  • 不支持 in_array,只能自己 for 循环判断

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK