Se ha denunciado esta presentación.
Utilizamos tu perfil de LinkedIn y tus datos de actividad para personalizar los anuncios y mostrarte publicidad más relevante. Puedes cambiar tus preferencias de publicidad en cualquier momento.

PHP Internals GDG

PHP Internals GDG

  • Sé el primero en comentar

PHP Internals GDG

  1. 1. PHP Internals
  2. 2. Why
  3. 3. Dynamical Typed * not the same x = “1”; $x = “1a”+1; Weakly Typed
  4. 4. Variables & copy on write <?php $ch = curl_init(); $post_data = array('a' => 1); var_dump($post_data); // int a curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data); var_dump($post_data); // string a Example 1
  5. 5. PHP Implementations • HHVM • PHP Compiler • Phalanger • PHP4Mono
  6. 6. PHP has no Specification yet
  7. 7. PHP Overview http://img.my.csdn.net/uploads/201107/4/0_1309773216dp36.gif
  8. 8. Cycle SAPI Starting Up CLI / mod_php Stopping Request Engine Start Config Init MINIT Process Request MSHUTDOWN Engine Shutdown
  9. 9. SAPI CLI http://flylib.com/books/2/565/1/html/2/images/01fig01.jpg
  10. 10. SAPI Single Process http://flylib.com/books/2/565/1/html/2/images/01fig02.jpg
  11. 11. SAPI Multiprocess (Apache 2, ISAPI) http://flylib.com/books/2/565/1/html/2/images/01fig03.jpg
  12. 12. SAPI - Multithreaded http://img.my.csdn.net/uploads/201107/4/0_1309773216dp36.gif
  13. 13. PHP Life Cycle (1)
  14. 14. Variables & copy on write
  15. 15. Zvals (1) typedef struct _zval_struct { zvalue_value value; /* variable value */ zend_uint refcount__gc; /* reference counter */ zend_uchar type; /* value type */ zend_uchar is_ref__gc; /* reference flag */ } zval; typedef union _zvalue_value { long lval; /* long value */ double dval; /* double value */ struct { char *val; int len; /* this will always be set for strings */ } str; /* string (always has length) */ HashTable *ht; /* an array */ zend_object_value obj; /* stores an object store handle, and handlers */ } zvalue_value;
  16. 16. Refcount http://www.phpinternalsbook.com/zvals/memory_management.html#reference-counting-and-copy-on-write
  17. 17. is_ref http://www.phpinternalsbook.com/zvals/memory_management.html#reference-counting-and-copy-on-write
  18. 18. Complie • lexical Anaysis- zend_language.scanner.i • Parser - zend_language_parser.y (yacc) • Zend VM -
  19. 19. Lexical analysis
  20. 20. Tokens
  21. 21. Parser
  22. 22. OpCodes
  23. 23. Increments - Pre http://www.phpinternalsbook.com/zvals/memory_management.html#reference-counting-and-copy-on-write What is faster ? • ++$a • $a++ • $a += 1; • $a = $a +1;
  24. 24. Function call http://www.phpinternalsbook.com/zvals/memory_management.html#reference-counting-and-copy-on-write <?php $b = "1"; hello($b); function hello($a){ echo $a; } <ST_IN_SCRIPTING>"while" { return T_WHILE; }
  25. 25. Singlish PHP ?

    Sé el primero en comentar

    Inicia sesión para ver los comentarios

  • mepasindu

    Feb. 14, 2015
  • Jacob0090

    Feb. 14, 2015

PHP Internals GDG

Vistas

Total de vistas

1.072

En Slideshare

0

De embebidos

0

Número de embebidos

11

Acciones

Descargas

14

Compartidos

0

Comentarios

0

Me gusta

2

×