The Little Guy Posted November 19, 2008 Share Posted November 19, 2008 I am programming with Strict programming, and when I loop through an array, I get: Notice: Undefined offset: 0 in /home/.marble/ryannaddy/dudeel.com/video/watch.php on line 283 Here is my function: function description($input){ $strs = explode(' ',$input); $maxlen = 10; $str = array(); for($i=0;$i<$maxlen;$i++){ $str[0] .= $strs[$i].' '; // Line 283 } for($j=$i;$j<count($strs)-$i;$j++){ $str[1] .= $strs[$j].' '; } return $str; } Link to comment https://forums.phpfreaks.com/topic/133286-solved-undefined-offset/ Share on other sites More sharing options...
The Little Guy Posted November 19, 2008 Author Share Posted November 19, 2008 nvm I fixed it: $str = array(0 => array(), 1 => array()); Link to comment https://forums.phpfreaks.com/topic/133286-solved-undefined-offset/#findComment-693211 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.