note 108999 added to function.next

From: Date: Mon, 11 Jun 2012 18:15:54 +0000
Subject: note 108999 added to function.next
Groups: php.notes 
Request: Send a blank email to php-notes+get-188529@lists.php.net to get a copy of this message
Note that to display the "array_values" into an html page, you must simply write like this (example with a call to soapClient::__getFunctions()) : <?php // .... set new $soap $result = $soap->__getFunctions(); echo('<pre>'); print_r(array_values($result)); echo('</pre>'); ?> This just because the "array_values" returns a PRE formatted text with CR and blanks chars. The best is to create into a library the function <?php function array_values2html($theArray=array()) { echo('<pre>'); print_r(array_values($result)); echo('</pre>'); ?> Remember : "print_r" writes without parameter into the buffer. If you want to get back the content string you must use the $return parameter. So an alternate syntax (more compact) is : <?php // .... set new $soap $result = $soap->__getFunctions(); echo('<pre>'.print_r(array_values($result,true).'</pre>'); ?> and for the function : <?php function array_values2html($theArray=array()) { return '<pre>').print_r(array_values($theArray,true).'</pre>'; } ?> Finally you will write generally in your compacted code : <?php // ... set $result as array echo (array_values2html($result)); ?> ---- Server IP: 89.31.146.176 Probable Submitter: 212.195.217.94 ---- Manual Page -- http://www.php.net/manual/en/function.next.php Edit -- https://master.php.net/note/edit/108999 Del: integrated -- https://master.php.net/note/delete/108999/integrated Del: useless -- https://master.php.net/note/delete/108999/useless Del: bad code -- https://master.php.net/note/delete/108999/bad+code Del: spam -- https://master.php.net/note/delete/108999/spam Del: non-english -- https://master.php.net/note/delete/108999/non-english Del: in docs -- https://master.php.net/note/delete/108999/in+docs Del: other reasons-- https://master.php.net/note/delete/108999 Reject -- https://master.php.net/note/reject/108999 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#188529) next »