![]() ![]() every time you swing through the loop, the condition has to be checked. Tried other random things but I am apparently missing something. adding a boolean or check variable or any kind of conditional inside of a loop is a very bad idea imho, i NEVER do it. but I'm not sure how I can do this considering the function starts over and is re-run everytime. In PHP the two basic constructs to get output are echo and print. I've tried using true / false variables as one would normally do to output something once in a for or foreach loop, but since the function is just recursively running until it times out, the function starts over again and this does not work.Īs I said, I can insert an array of variables into this function to help me. but the issue is CURL does not have the $downloaded_size or $download_size variables set and display as 0 bytes - therefore it needs to be in the else condition. Tip: The echo () function is slightly faster than print (). ![]() However, if you want to pass more than one parameter to echo (), using parentheses will generate a parse error. Note: The echo () function is not actually a function, so you are not required to use parentheses with it. If ($count = 1) Īnd it works to only echo once. The echo () function outputs one or more strings. I've tried things such as static $previousProgress = 0 What I'm trying to do is simply echo this line ONCE after the else condition echo ' '. The once directive allows you to define a portion of the template that. $progress = round( $downloaded_size * 100 / $download_size ) Īs you can see I'm inserting my own variables with use at the end of the function. In fact, you can put any PHP code you wish inside of a Blade echo statement. ![]() Here is my function: curl_setopt( $curl, CURLOPT_PROGRESSFUNCTION, function ( $resource, $download_size, $downloaded_size, $upload_size, $uploaded_size) use ($array) ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |