Skip to content

Instantly share code, notes, and snippets.

@srogier
Created August 28, 2012 15:25
Show Gist options
  • Save srogier/3499079 to your computer and use it in GitHub Desktop.
Save srogier/3499079 to your computer and use it in GitHub Desktop.
sizeof vs count
sizeof(array('foo'));
line # opcode result operands
-----------------------------------------------------------------------------
2 0 EXT_STMT
1 EXT_FCALL_BEGIN
2 INIT_ARRAY ~0 'foo', 0
3 SEND_VAL ~0, 1
4 DO_FCALL 'sizeof'
5 EXT_FCALL_END
3 6 RETURN 1
count(array('foo'))
Number of oplines: 7
line # opcode result operands
-----------------------------------------------------------------------------
2 0 EXT_STMT
1 EXT_FCALL_BEGIN
2 INIT_ARRAY ~0 'foo', 0
3 SEND_VAL ~0, 1
4 DO_FCALL 'count'
5 EXT_FCALL_END
3 6 RETURN
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment