phpversion 


php128 apg

GETS the information of version of the currently PHP or, optionaly, of an extension.



<?php

str phpversion 
( str $extension = ? )


where,

$extension = Extension name
                   
?>

$extension


One of the extension, (library), names obtained through the get_loaded_extensions.





If the optional $extension is specified, this functions returns the version of that extension, or FALSE if there is no version information associated or the extension isn't enabled.



  1 EXERCISE   

<?php

echo 'PHP version: ' . phpversion(); 
// PHP extension versioning
        
?>


  2 EXERCISE   

<?php

echo 'PHAR extension version: ' . phpversion('phar'); 
// PHAR extension versioning
        
?>


  3 EXERCISE   

<style> 
td { text-align:center; } 
</style> 
<table width="100%" cellspacing="3" cellpadding="3" 
border="1" align="center"> 
<tbody><tr><td colspan="3">AVAILABLE EXTENSIONS</td></tr> 
<tr><td>Index</td><td>NAME</td><td>VERSION</td></tr> 
<?php 

// This exercise displays 
// the name and version of all the loaded extension.

// The result of this exercise 
// may be different for you

$exts = get_loaded_extensions (); 

$i = 0;

foreach ( 
$exts as $xt) 
{ 
     
$exts03 = phpversion ($xt);  

echo 
'<tr><td>'. $i++ . '</td><td>' . $xt . '</td><td>' . $exts03 . '</td></tr>'; 
     
} 
?> 
<tr><td colspan="3">ed48</td></tr></tbody></table>