User Tools

Site Tools


programmieren:php:wichtigefunktionen

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
programmieren:php:wichtigefunktionen [2026/08/07 16:10] – array functions adminprogrammieren:php:wichtigefunktionen [2026/08/21 16:04] (current) – memory usage admin
Line 1: Line 1:
-====== Wichtigefunktionen ======+====== Wichtige Funktionen ======
  
 ===== Array Functions ===== ===== Array Functions =====
Line 10: Line 10:
  
 My beloved. This is used to get arrays nested within other arrays to all be on the same level. My beloved. This is used to get arrays nested within other arrays to all be on the same level.
 +
 +===== Debugging functions =====
 +
 +<code php>
 +debug($anyVariableYouMayWantToDebug)
 +</code>
 +
 +CakePHP only. PHP Equivalent is print_r().
 +Is useful to debug certain things and to set a breakpoint right at that place.
 +
 +<code php>
 +var_dump($anyVariableYouMayWantToDump)
 +</code>
 +
 +Native PHP.
 +Basically echoes any variable with all its details to whatever interface you're working on. Great to see what actual data you get from something like an API.
 +
 +===== Memory Usage functions =====
 +
 +Theres functions in PHP to measure and display your current and your peak memory usage:
 +
 +<code php>
 +$memoryCurrentlyUsed = memory_get_usage(true) // The parameter makes it take the real allocated usage
 +
 +$memoryPeakUsage = memory_get_peak_usage(true) // These will give back an int value of bytes used
 +
 +memory_reset_peak_usage() // Needs to be run to reset the peak usage, if needed
 +</code>
 +
programmieren/php/wichtigefunktionen.1786111813.txt.gz · Last modified: by admin

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki